计算下面一系列的数学计算在1s中能执行过少次。
#include "stdio.h" #include "time.h" int i, j, l, k, m, jj; jj = 2342; k = 31455; l = 16452; m = 9823; i = 1000000; void main() { int warp_count = 0; int max_warp = 1000; long int count = 0; time_t b_second,l_second; time_t rawtime; struct tm * timeinfo; while(1){ b_second = time(NULL); l_second = b_second+1; while ((b_second=time(NULL))<l_second) { m = m ^ l; k = (k / m * jj) % i; l = j * m * k; i = (j * k) ^ m; k = (k / m * jj) % i; m = m ^ l; m = m ^ l; i = (j * k) ^ m; k = (k / m * jj) % i; m = i * i * i * i * i * i * i; // m=k*l*jj*l; m = m ^ l; k = (k / m * jj) % i; l = j * m * k; i = (j * k) ^ m; l = (k / m * jj) % i; m = m ^ l; m = m ^ l; i = (j * k) ^ m; k = (k / m * jj) % i; m = k * k * k * k * k - m / i; count++; } time(&rawtime); timeinfo = localtime (&rawtime); printf("Time: %s ", asctime (timeinfo)); printf("%ld\n",count); count=0; warp_count++; if(warp_count==max_warp) break; } }
时间: 2024-10-24 23:49:09