ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¤@»õ­Ó ¥[ªk¹Bºâ¡A¤j·§»Ý­n 8.9 ¬íÄÁ

¤@»õ­Ó ¥[ªk¹Bºâ¡A¤j·§»Ý­n 8.9 ¬íÄÁ

Sub ­p®É½X¿ö()
   Dim byou1, byou2 As Double
   Dim i As Long
   Dim sum As Double
   
   ' integer ¥u¯à­pºâ¨ì 32767, ¶W¹Lªº¸Ü¡Aµ{¦¡·|·í±¼
   ' long ¥u¯à­pºâ¨ì 2147483647, ¶W¹Lªº¸Ü¡Aµ{¦¡·|·í±¼
   ' double ¥i¥H­pºâ¨ì 10^ +308 ¥ª¥k
   
    ' MsgBox "«ö¤U½T©w«ö¶s«á¶}©l­p®É"
    byou1 = Timer
   
    sum = 0#
    For i = 1 To 100000000
       sum = sum + i
    Next i
   
    ' MsgBox "¦A«ö¤@¦¸½T©w«ö¶s°±¤î­p®É"
    byou2 = Timer
   
    MsgBox "¸g¹Lªº®É¶¡¬° " & byou2 - byou1 & " ¬í, " & sum
    ' ¤@»õ­Ó ¥[ªk¹Bºâ¡A¤j·§»Ý­n 8.9 ¬íÄÁ¡A¤ñC++ºC¤F«Ü¦h
End Sub
¤Ñ¤U¬°¤½

§Úªº¹q¸£¥u­n5.2¬í
ss

TOP

½Ð©ú¥Õ, VBA ¤ñCºC¬O¥¿±`ªº, ¤j®aªº¥Î³~¤j¤£¤@¼Ë
ss

TOP

¦^´_ 2# sunnyso
«e½ú!
        ¤£·|§a!¤p§Ìªº¥u­n2.9296875
        ³o¬O«ç»ò¦^¨Æ©O?!!

TOP

§ÚªºÂ¹q¸£³ºµM¥i¥H¶] 2.05¬í
CPU [email protected]
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

§Úªº¬Ocore T9300
ss

TOP

  1. Function time1() As Long
  2.    Dim t1 As Double
  3.    Dim t2 As Long
  4.    
  5.    t1 = Timer
  6.    t2 = Int(t1 * 1000# + 0.5)
  7.    ' get milli- seconds
  8.    
  9.    time1 = t2
  10. End Function


  11. Function time2(t1 As Long) As Double
  12.    Dim t2 As Long
  13.    Dim dt As Double
  14.    
  15.    t2 = time1()
  16.    dt = (t2 - t1) / 1000#
  17.    ' get seconds
  18.    
  19.    
  20.    ' dt must >= 0.0
  21.    If (dt < 0#) Then
  22.       dt = dt + 1# * 24 * 60 * 60
  23.       
  24.    End If
  25.    time2 = dt
  26. End Function


  27. Sub test1125()
  28.    Dim no As Long, t1 As Long, t2 As Long, i As Long
  29.    Dim dt As Double, ct As Integer
  30.    Dim sum As Double
  31.    
  32.    no = 100000000
  33.    ct = 5
  34.    
  35.    While (no > 10)
  36.       ct = ct + 1
  37.       t1 = time1()
  38.          sum = 0#
  39.          For i = 1 To no
  40.             sum = sum + i
  41.             
  42.          Next i
  43.       dt = time2(t1)
  44.       
  45.       Cells(ct, 1) = no
  46.       Cells(ct, 2) = sum
  47.       Cells(ct, 3) = dt
  48.       
  49.       no = no / 2
  50.    Wend
  51.    
  52.    MsgBox ("Done! ")
  53. End Sub
½Æ»s¥N½X
¦^´_ 6# ML089
¤Ñ¤U¬°¤½

TOP

¦^´_ 8# sjgau


¤½¥q¹q¸£ I5 [email protected] ¶] 1.918¬í
»P®a¸Ì¹q¸£(§C¶¥CPU)ªº³t«×¤£·|®t²§«Ü¦h
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

  1. #if 0

  2. s1= 1382833070, s2= 778

  3. s2 < 0, . . .

  4. s1= 4, s2= 812
  5. sum= 5.000000E+017
  6. ½Ð«ö¥ô·NÁäÄ~Äò . . .

  7. #endif
  8. // ----------------------------------------------

  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <sys/timeb.h>

  12. int main(int argc, char *argv[])
  13. {
  14.    struct timeb now;
  15.    int s1, s2;
  16.    
  17.    ftime(&now);
  18.    s1= now.time;
  19.    s2= now.millitm;
  20.    
  21.    printf("s1= %d, s2= %d \n", s1, s2);
  22.    // system("pause");
  23.    // -------------------------------------------
  24.    
  25.    double sum;
  26.    int no, i;
  27.    
  28.    no= 1000000000;
  29.    sum= 0.0;
  30.    for (i=1;i<=no;i++) {
  31.        sum= sum + i;
  32.    }
  33.    
  34.    ftime(&now);
  35.    s1= now.time - s1;
  36.    s2= now.millitm - s2;
  37.    if (s2 < 0) {
  38.       printf("\n s2 < 0, . . . \n");
  39.       s2+= 1000;
  40.       s1--;
  41.    }
  42.    
  43.    printf("\n s1= %d, s2= %d \n", s1, s2);
  44.    printf(" sum= %.6lE \n", sum);
  45.    system("pause");
  46.    
  47.    return 0;
  48. }
½Æ»s¥N½X
¦^´_ 1# sjgau
¤Ñ¤U¬°¤½

TOP

C »y¨¥ µ{¦¡³]­p¡A°õ¦æ ¤Q»õ­Ó ®aªk¹Bºâ¡A
¥u»Ý­n 4.8¬íÄÁ
¤Ñ¤U¬°¤½

TOP

        ÀR«ä¦Û¦b : ¥Ç¿ù¥XÄb®¬¤ß¡A¤~¯à²M²bµL·Ð´o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD