E81086713E446D36F62B2AA2A3502B5EB155

          Java雜家

          雜七雜八。。。一家之言

          BlogJava 首頁 新隨筆 聯系 聚合 管理
            40 Posts :: 1 Stories :: 174 Comments :: 0 Trackbacks

          2009年4月24日 #

          如題:求連續正整數使得其和為給定的一個正整數
          下面給出我的解法,幾乎可以一步到位求出來
          實現代碼如下:
          /**
          *Author: Koth (
          http://weibo.com/yovn)
          *Date:  2011-12-01
          */
          #include 
          <stdlib.h>
          #include 
          <stdio.h>
          #include 
          <stdint.h>

          int solve(int Y,int& X){
              
          int m=0;
              
          int t=Y;
              
          if(Y<=0){
                  X
          =Y;
                  
          return 1;
              }
              
          while((t&1)==0){
                  m
          +=1;
                  t
          =t>>1;
              }
              
          if(m==32){
                  X
          =Y;
                  
          return 1;
              }
              
          int lastK=32;
              
          for(;lastK>m+1;lastK--){
                  
          if(Y &(1<<(lastK-1))){
                      
                      
          break;
                  }
                      
              }

              
          //its a number st. exp(2,K)
              if(lastK==(m+1)){
                  X
          =Y;
                  
          return 1;
              }
              
          int k=1<<(m+1);
              
          int b=(Y>>m)-(1<<(lastK-m-1));

              X
          =(1<<(lastK-m-2))+(b+1-k)/2;

              
          if(X<=0){
                  k
          =k-1-((0-X)<<1);
                  X
          =0-X+1;
              }
              
              
          return k;

          }

          int main(int argc,char* argv[]){
              
          if(argc<=1){
                  fprintf(stdout,
          "Usage:%s number\n",argv[0]);
                  
          return 0;
              }
              
          int Y=atoi(argv[1]);
              
          int X=0;
              
          int k=solve(Y,X);
              fprintf(stdout,
          "%d=",Y);
              
          for(int i=0;i<k;i++){
                  fprintf(stdout,
          "%d",X+i);
                  
          if(i<(k-1)){
                      fprintf(stdout,
          "+");
                  }
              }
              fprintf(stdout,
          "\n");
              
          return 0;
          }
          posted @ 2011-12-01 22:09 DoubleH 閱讀(1777) | 評論 (2)編輯 收藏

               摘要: 年過的差不多了,今天偶爾興起上HOJ上翻幾道DP練手的題來。。。,順便把代碼貼下留念  1.數塔 Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->/**  *   */ pack...  閱讀全文
          posted @ 2011-02-06 21:13 DoubleH 閱讀(2019) | 評論 (0)編輯 收藏

               摘要: 前一篇博客,我簡單提了下怎么為NIO2增加TransmitFile支持,文件傳送吞吐量是一個性能關注點,此外,并發連接數也是重要的關注點。 不過JDK7中又一次做了簡單的實現,不支持同時投遞多個AcceptEx請求,只支持一次一個,返回后再投遞。這樣,客戶端連接的接受速度必然大打折扣。不知道為什么sun會做這樣的實現,WSASend()/WSAReceive()一次只允許一個還是可以理解,...  閱讀全文
          posted @ 2009-12-04 17:57 DoubleH 閱讀(3898) | 評論 (6)編輯 收藏

          JDK7的NIO2特性或許是我最期待的,我一直想基于它寫一個高性能的Java Http Server.現在這個想法終于可以實施了。
          本人基于目前最新的JDK7 b76開發了一個HTTP Server性能確實不錯。
          在windows平臺上NIO2采用AccpetEx來異步接受連接,并且讀寫全都關聯到IOCP完成端口。不僅如此,為了方便開發者使用,連IOCP工作線程都封裝好了,你只要提供線程池就OK。

          但是要注意,IOCP工作線程的線程池必須是 Fix的,因為你發出的讀寫請求都關聯到相應的線程上,如果線程死了,那讀寫完成情況是不知道的。

          作為一個Http Server,傳送文件是必不可少的功能,那一般文件的傳送都是要把程序里的buffer拷貝到內核的buffer,由內核發送出去的。windows平臺上為這種情況提供了很好的解決方案,使用TransmitFile接口

          BOOL TransmitFile(
              SOCKET hSocket,
              HANDLE hFile,
              DWORD nNumberOfBytesToWrite,
              DWORD nNumberOfBytesPerSend,
              LPOVERLAPPED lpOverlapped,
              LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
              DWORD dwFlags
          );

          你只要把文件句柄發送給內核就行了,內核幫你搞定其余的,真正做到Zero-Copy.
          但是很不幸,NIO2里AsynchronousSocketChannel沒有提供這樣的支持。而為HTTP Server的性能考量,本人只好自己增加這個支持。

          要無縫支持,這個必須得表現的跟 Read /Write一樣,有完成的通知,通知傳送多少數據,等等。

          仔細讀完sun的IOCP實現以后發現這部分工作他們封裝得很好,基本只要往他們的框架里加東西就好了。
          為了能訪問他們的框架代碼,我定義自己的TransmitFile支持類在sun.nio.ch包里,以獲得最大的權限。

          package sun.nio.ch;

          import java.io.IOException;
          import java.lang.reflect.Field;
          import java.nio.channels.AsynchronousCloseException;
          import java.nio.channels.AsynchronousSocketChannel;
          import java.nio.channels.ClosedChannelException;
          import java.nio.channels.CompletionHandler;
          import java.nio.channels.NotYetConnectedException;
          import java.nio.channels.WritePendingException;
          import java.util.concurrent.Future;


          /**

           * 
          @author Yvon
           * 
           
          */
          public class WindowsTransmitFileSupport {
             
             //Sun's NIO2 channel  implementation class
              
          private WindowsAsynchronousSocketChannelImpl channel;
             
              //nio2 framework core data structure
              PendingIoCache ioCache;

             //some field retrieve from sun channel implementation class
              
          private Object writeLock;
              
          private Field writingF;
              
          private Field writeShutdownF;
              
          private Field writeKilledF; // f

              WindowsTransmitFileSupport()
              {
                  
          //dummy one for JNI code
              }

              
          /**
               * 
               
          */
              
          public WindowsTransmitFileSupport(
                      AsynchronousSocketChannel
                       channel) {

                  
          this.channel = (WindowsAsynchronousSocketChannelImpl)channel;
                  
          try {
                  // Initialize the fields
                      Field f 
          = WindowsAsynchronousSocketChannelImpl.class
                              .getDeclaredField(
          "ioCache");
                      f.setAccessible(
          true);
                      ioCache 
          = (PendingIoCache) f.get(channel);
                      f 
          = AsynchronousSocketChannelImpl.class
                              .getDeclaredField(
          "writeLock");
                      f.setAccessible(
          true);
                      writeLock 
          = f.get(channel);
                      writingF 
          = AsynchronousSocketChannelImpl.class
                              .getDeclaredField(
          "writing");
                      writingF.setAccessible(
          true);

                      writeShutdownF 
          = AsynchronousSocketChannelImpl.class
                              .getDeclaredField(
          "writeShutdown");
                      writeShutdownF.setAccessible(
          true);

                      writeKilledF 
          = AsynchronousSocketChannelImpl.class
                              .getDeclaredField(
          "writeKilled");
                      writeKilledF.setAccessible(
          true);

                  } 
          catch (NoSuchFieldException e) {
                      
          // TODO Auto-generated catch block
                      e.printStackTrace();
                  } 
          catch (SecurityException e) {
                      
          // TODO Auto-generated catch block
                      e.printStackTrace();
                  } 
          catch (IllegalArgumentException e) {
                      
          // TODO Auto-generated catch block
                      e.printStackTrace();
                  } 
          catch (IllegalAccessException e) {
                      
          // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
              }

              
              
          /**
               * Implements the task to initiate a write and the handler to consume the
               * result when the send file completes.
               
          */
              
          private class SendFileTask<V, A> implements Runnable, Iocp.ResultHandler {
                  
          private final PendingFuture<V, A> result;
                  
          private final long file;//file is windows file HANDLE

                  SendFileTask(
          long file, PendingFuture<V, A> result) {
                      
          this.result = result;
                      
          this.file = file;
                  }

              

                  @Override
                  
          // @SuppressWarnings("unchecked")
                  public void run() {
                      
          long overlapped = 0L;
                      
          boolean pending = false;
                      
          boolean shutdown = false;

                      
          try {
                          channel.begin();

                  

                          
          // get an OVERLAPPED structure (from the cache or allocate)
                          overlapped = ioCache.add(result);
                          
          int n = transmitFile0(channel.handle, file, overlapped);
                          
          if (n == IOStatus.UNAVAILABLE) {
                              
          // I/O is pending
                              pending = true;
                              
          return;
                          }
                          
          if (n == IOStatus.EOF) {
                              
          // special case for shutdown output
                              shutdown = true;
                              
          throw new ClosedChannelException();
                          }
                          
          // write completed immediately
                          throw new InternalError("Write completed immediately");
                      } 
          catch (Throwable x) {
                          
          // write failed. Enable writing before releasing waiters.
                          channel.enableWriting();
                          
          if (!shutdown && (x instanceof ClosedChannelException))
                              x 
          = new AsynchronousCloseException();
                          
          if (!(x instanceof IOException))
                              x 
          = new IOException(x);
                          result.setFailure(x);
                      } 
          finally {
                          
          // release resources if I/O not pending
                          if (!pending) {
                              
          if (overlapped != 0L)
                                  ioCache.remove(overlapped);
                          
                          }
                          channel.end();
                      }

                      
          // invoke completion handler
                      Invoker.invoke(result);
                  }

                  

                  
          /**
                   * Executed when the I/O has completed
                   
          */
                  @Override
                  @SuppressWarnings(
          "unchecked")
                  
          public void completed(int bytesTransferred, boolean canInvokeDirect) {
              

                      
          // release waiters if not already released by timeout
                      synchronized (result) {
                          
          if (result.isDone())
                              
          return;
                          channel.enableWriting();

                          result.setResult((V) Integer.valueOf(bytesTransferred));

                      }
                      
          if (canInvokeDirect) {
                          Invoker.invokeUnchecked(result);
                      } 
          else {
                          Invoker.invoke(result);
                      }
                  }

                  @Override
                  
          public void failed(int error, IOException x) {
                      
          // return direct buffer to cache if substituted
                  

                      
          // release waiters if not already released by timeout
                      if (!channel.isOpen())
                          x 
          = new AsynchronousCloseException();

                      
          synchronized (result) {
                          
          if (result.isDone())
                              
          return;
                          channel.enableWriting();
                          result.setFailure(x);
                      }
                      Invoker.invoke(result);
                  }

              }

              
          public <extends Number, A> Future<V> sendFile(long file, A att,
                      CompletionHandler
          <V, ? super A> handler) {

                  
          boolean closed = false;
                  
          if (channel.isOpen()) {
                      
          if (channel.remoteAddress == null)
                          
          throw new NotYetConnectedException();

                      
                      
          // check and update state
                      synchronized (writeLock) {
                          
          try{
                          
          if (writeKilledF.getBoolean(channel))
                              
          throw new IllegalStateException(
                                      
          "Writing not allowed due to timeout or cancellation");
                          
          if (writingF.getBoolean(channel))
                              
          throw new WritePendingException();
                          
          if (writeShutdownF.getBoolean(channel)) {
                              closed 
          = true;
                          } 
          else {
                              writingF.setBoolean(channel, 
          true);
                          }
                          }
          catch(Exception e)
                          {
                              IllegalStateException ise
          =new IllegalStateException(" catch exception when write");
                              ise.initCause(e);
                              
          throw ise;
                          }
                      }
                  } 
          else {
                      closed 
          = true;
                  }

                  
          // channel is closed or shutdown for write
                  if (closed) {
                      Throwable e 
          = new ClosedChannelException();
                      
          if (handler == null)
                          
          return CompletedFuture.withFailure(e);
                      Invoker.invoke(channel, handler, att, 
          null, e);
                      
          return null;
                  }



                  
          return implSendFile(file,att,handler);
              }


              
          <extends Number, A> Future<V> implSendFile(long file, A attachment,
                      CompletionHandler
          <V, ? super A> handler) {
                  
          // setup task
                  PendingFuture<V, A> result = new PendingFuture<V, A>(channel, handler,
                          attachment);
                  SendFileTask
          <V,A> sendTask=new SendFileTask<V,A>(file,result);
                  result.setContext(sendTask);
                  
          // initiate I/O (can only be done from thread in thread pool)
                  
          // initiate I/O
                  if (Iocp.supportsThreadAgnosticIo()) {
                      sendTask.run();
                  } 
          else {
                      Invoker.invokeOnThreadInThreadPool(channel, sendTask);
                  }
                  
          return result;
              }
              
              
          private native int transmitFile0(long handle, long file,
                      
          long overlapped);
              
          }

          這個操作跟默認實現的里的write操作是很像的,只是最后調用的本地方法不一樣。。

          接下來,我們怎么使用呢,這個類是定義在sun的包里的,直接用的話,會報IllegalAccessError,因為我們的類加載器跟初始化加載器是不一樣的。
          解決辦法一個是通過啟動參數-Xbootclasspath,讓我們的包被初始加載器加載。我個人不喜歡這種辦法,所以就采用JNI來定義我們的windows TransmitFile支持類。

          這樣我們的工作算是完成了,注意,發送文件的時候傳得是文件句柄,這樣做的好處是你可以更好的控制,一般是在發送前,打開文件句柄,完成后在回調通知方法里關閉文件句柄。



          有興趣的同學可以看看我的HTTP server項目:
          http://code.google.com/p/jabhttpd/

          目前基本功能實現得差不多,做了些簡單的測試,性能比較滿意。這個服務器不打算支持servlet api,基本是專門給做基于長連接模式通信的定做的。






          posted @ 2009-11-29 15:19 DoubleH 閱讀(2597) | 評論 (2)編輯 收藏

          問題:
          有個鏈表(List),有N個元素,當N很大的時候,我們通常想分批處理該鏈表。假如每次處理M條(0<M<=N),那么需要處理幾次才能處理完所有數據呢?

          問題很簡單,我們需要<N/M>次,這里我們用<>表示向上取整,[]表示向下取整,那么怎么來表示這個值呢?
          我們可以證明:
          <N/M>=[(N-1)/M]+1    (0<M<=N,M,N∈Z)

          不失一般性,我們設N=Mk+r(0<=r<M),
          1)當r>0時,

          左邊:<N/M>=<(Mk+r)/M>=<k+r/M>=k+<r/M>=k+1
          右邊:[(N-1)/M]+1=[(Mk+r-1)/M]+1=[k+(r-1)/M]+1=k+1+[(r-1)/M]=k+1
          2)當r=0
          左邊:<N/M>=k
          右邊:[(N-1)/M]+1=[(Mk-1)/M]+1=[(M(k-1)+M-1)/M]+1=[k-1+(M-1)/M]+1=k+[(M-1)/M]=k

          命題得證。

          有了這個公式,我們在Java代碼里可以這樣計算:
          int nn=(N-1)/+1
          .


          因為'/'是往下取整的。








          posted @ 2009-05-04 11:45 DoubleH 閱讀(3977) | 評論 (4)編輯 收藏

          原題:

          Command Network

          Description

          After a long lasting war on words, a war on arms finally breaks out between littleken’s and KnuthOcean’s kingdoms. A sudden and violent assault by KnuthOcean’s force has rendered a total failure of littleken’s command network. A provisional network must be built immediately. littleken orders snoopy to take charge of the project.

          With the situation studied to every detail, snoopy believes that the most urgent point is to enable littenken’s commands to reach every disconnected node in the destroyed network and decides on a plan to build a unidirectional communication network. The nodes are distributed on a plane. If littleken’s commands are to be able to be delivered directly from a node A to another node B, a wire will have to be built along the straight line segment connecting the two nodes. Since it’s in wartime, not between all pairs of nodes can wires be built. snoopy wants the plan to require the shortest total length of wires so that the construction can be done very soon.

          Input

          The input contains several test cases. Each test case starts with a line containing two integer N (N ≤ 100), the number of nodes in the destroyed network, and M (M ≤ 104), the number of pairs of nodes between which a wire can be built. The next N lines each contain an ordered pair xi and yi, giving the Cartesian coordinates of the nodes. Then follow M lines each containing two integers i and j between 1 and N (inclusive) meaning a wire can be built between node i and node j for unidirectional command delivery from the former to the latter. littleken’s headquarter is always located at node 1. Process to end of file.

          Output

          For each test case, output exactly one line containing the shortest total length of wires to two digits past the decimal point. In the cases that such a network does not exist, just output ‘poor snoopy’.


          一開始沒仔細讀題,一看以為是最小生成樹呢,結果Krusal算法上去WA了,Prim算法也WA,修修改改一直WA,第二天發現本題是要在有向圖上面構造最小樹形圖。

          按照著名的Zhu-Liu算法,仔細實現了一邊,終于AC了。
          按照我的理解總結下該算法,該算法對每個結點,除根節點外尋找最小入邊,
          1)如果這些入邊不構成環,那么容易證明這些邊構成最小樹形圖。
          證明:設加上根節點r一共N個點,那么一共有N-1條邊,證明從r能到每個點,若存在一點v,使得從r到v沒有路徑,那么,假設從v反向回退必然構成環,因為每個點除了r都有入邊,如果不構成環,該路徑可以無窮大。
          2)如果存在環,我們把環收縮成一個點,更新相應的入邊和出邊,得到新的圖G',使得原問題在G'中等效:
          怎么收縮呢?
          假設我們把環收縮成環上的任意一點v,所有進環的邊和出環的邊自動變成v的邊(如果已有,取長度最短的),其余點標記為刪除,更新不在環上的所有點進入該環的長度cost為cost-cost(prev[x],x);其中點x為進入環的邊在環上的端點。出邊保持不變。

          這里為什么這么更新?因為這樣更新使得我們的算法在新圖上是等效的。任何環的解決后意味著在新圖里面得為改收縮后的點尋找新的入邊,而實際的花費應該是新的入邊減去原有的入邊長度,我們的算法在找到環的時候就把環上所有的邊的長度計算在花費內了.而對出邊是沒有影響的。


          到這算法的框架基本出來了。當為某點沒找到入邊的時候,意味著無解。為了加快無解的偵測,我們先運行一遍DFS搜索,假如從根節點出發,可觸及的節點數小于N-1(不含r)則意味著無解。反之,肯定有解。
          為什么?
          因為如果可觸及數小于N-1,意味著某點是不可觸及的,也就是原圖不是弱連通。對該點來說不存在從r到它的路徑。反之,從r到某點都有一條路徑,沿著該路徑就能找到結點的入邊。


          第二個問題是,如何快速偵測環呢?
          我使用了一個不相交集。回憶Krusal的算法實現里面也是使用不相交集來避免找產生環的最小邊。

          下面是我的代碼:

          // 3164.cpp : Defines the entry point for the console application.
          //

          #include 
          <iostream>
          #include 
          <cmath>


          using namespace std;

          typedef 
          struct _Point
          {

              
          double x;
              
          double y;

              
          double distanceTo(const struct _Point& r)
              {
                    
          return sqrt((x-r.x)*(x-r.x)+(y-r.y)*(y-r.y));

              }

          }Point;



          const int MAX_V=100;
          const int MAX_E=10000;
          const double NO_EDGE=1.7976931348623158e+308;

          Point vertexes[MAX_V]
          ={0};
          int parents[MAX_V]={0};
          int ranks[MAX_V]={0};
          double G[MAX_V][MAX_V]={0};
          bool visited[MAX_V]={0};
          bool deleted[MAX_V]={0};
          int prev[MAX_V]={0};

          int nVertex=0;
          int nEdge=0;




          int u_find(int a)
          {
              
          if(parents[a]==a)return a;
              parents[a]
          =u_find(parents[a]);
              
          return parents[a];
          }
          void u_union(int a,int b)
          {
              
          int pa=u_find(a);
              
          int pb=u_find(b);
              
          if(ranks[pa]==ranks[pb])
              {
                  ranks[pa]
          ++;
                  parents[pb]
          =pa;
              }
          else if(ranks[pa]<ranks[pb])
              {
                  parents[pa]
          =pb;
              }
              
          else
              {
                  parents[pb]
          =pa;
              }
          }

          void DFS(int v,int& c)
          {

              visited[v]
          =true;
              
          for(int i=1;i<nVertex;i++)
              {
                  
          if(!visited[i]&&G[v][i]<NO_EDGE)
                  {
                      c
          +=1;

                      DFS(i,c);
                  }

              }

          }



          void doCycle(int s,int t,double& cost)
          {
              memset(visited,
          0,sizeof(bool)*nVertex);
              
          int i=s;
              
          do
              {
                  visited[i]
          =true;
                  cost
          +=G[prev[i]-1][i];
                  
          //cout<<"from "<<(prev[i]-1)<<" to "<<i<<" (cycle)"<<" weight:"<<G[prev[i]-1][i]<<endl;
                  i=prev[i]-1;

              }
          while(i!=s);


              
          do
              {
                  

                  
          for(int k=0;k<nVertex;k++)
                  {
                      
          if(!deleted[k]&&!visited[k])
                      {
                      
                          
          if(G[k][i]<NO_EDGE)
                          {
                              
          if(G[k][i]-G[prev[i]-1][i]<G[k][s])
                              {


                                  G[k][s]
          =G[k][i]-G[prev[i]-1][i];
                                  
          //cout<<"1.update ["<<k<<","<<s<<"] at "<<i<<" as "<<G[k][s]<<endl;
                              }
                              

                          }
                          
          if(G[i][k]<NO_EDGE)
                          {
                              
          if(G[i][k]<G[s][k])
                              {

                                  G[s][k]
          =G[i][k];
                                  
          //cout<<"2.update ["<<s<<","<<k<<"] at "<<i<<" as "<<G[s][k]<<endl;
                              }
                              
                          }
                      }
                  }


                  
          if(i!=s)
                  {
                      deleted[i]
          =true;
                      
          //cout<<"mark "<<i<<" as deleted"<<endl;
                  }
                  i
          =prev[i]-1;


              }
          while(i!=s);



          }




          int main(void)
          {



              
              
          while(cin>>nVertex>>nEdge)
              {

                  
          int s,t;

                  
          int nv=0;
                  
          bool cycle=0;
                  
          double cost=0;
                  memset(vertexes,
          0,sizeof(vertexes));
                  memset(visited,
          0,sizeof(visited) );

                  memset(deleted,
          0,sizeof(deleted));
                  memset(G,
          0,sizeof(G));
                  memset(prev,
          0,sizeof(prev));


                  memset(ranks,
          0,sizeof(ranks));

                  memset(parents,
          0,sizeof(parents));

                  
          for(int i=0;i<nVertex;i++)
                  {

                      cin
          >>vertexes[i].x>>vertexes[i].y;
                      parents[i]
          =i;
                      
          for(int j=0;j<nVertex;j++)
                      {
                          G[i][j]
          =NO_EDGE;
                      }

                  }
                  
          for(int i=0;i<nEdge;i++)
                  {

                      cin
          >>s>>t;
                      
          if(t==1||s==t)continue;
                      G[s
          -1][t-1]=vertexes[s-1].distanceTo(vertexes[t-1]);

                  }



                  DFS(
          0,nv);
                  
          if(nv<nVertex-1)
                  {

                      cout
          <<"poor snoopy"<<endl;
                      
          continue;
                  }



                  
          do {
                      cycle
          =false;
                      
          for(int i=0;i<nVertex;i++){parents[i]=i;}
                      memset(ranks,
          0,sizeof(bool)*nVertex);
                  

                      
          for (int i = 1; i < nVertex; i++) {
                          
          double minimum=NO_EDGE;
                          
          if(deleted[i])continue;
                          
          for(int k=0;k<nVertex;k++)
                          {
                              
          if(!deleted[k]&&minimum>G[k][i])
                              {
                                  prev[i]
          =k+1;
                                  minimum
          =G[k][i];
                              }
                          }
                          
          if(minimum==NO_EDGE)
                          {
                          

                              
          throw 1;
                          }
                          
          if (u_find(prev[i]-1== u_find(i)) {
                              doCycle(prev[i]
          -1,i, cost);
                              cycle 
          = true;
                              
          break;
                          }
                          
          else
                          {
                              u_union(i,prev[i]
          -1);
                          }

                      }


                  } 
          while (cycle);

                  
          for (int i = 1; i < nVertex; i++) {
                      
          if(!deleted[i])
                      {
                          cost
          +=G[prev[i]-1][i];
                          
          //cout<<"from "<<(prev[i]-1)<<" to "<<i<<" weight:"<<G[prev[i]-1][i]<<endl;
                      }

                  }

                  printf(
          "%.2f\n",cost);


              }


          }



          posted @ 2009-04-24 16:39 DoubleH 閱讀(2426) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 昌吉市| 绍兴县| 盐津县| 托克托县| 淳安县| 太仆寺旗| 图木舒克市| 友谊县| 马山县| 定兴县| 南陵县| 昭苏县| 兰西县| 云南省| 教育| 塔河县| 沂南县| 马关县| 岗巴县| 灵台县| 新和县| 玉门市| 锦屏县| 湘阴县| 嘉禾县| 富源县| 龙门县| 周口市| 文水县| 探索| 贵港市| 汤原县| 乌什县| 南平市| 海兴县| 武宁县| 宜川县| 武川县| 莱阳市| 云龙县| 沙河市|