测量算法的运行时间

#include <stdio.h>
#include <time.h>

int F(int x);

int main()
{
	int x, y;
	clock_t t1, t2;
	double t;
	scanf("%d", &x);
	t1 = clock();
	y = F(x);
	t2 = clock();
	t =(t2-t1)/(double)(CLOCKS_PER_SEC);
	printf("%d\n", y);
	printf("It took %.2f second(s).\n", t);
	return 0;
}

int F(int x)
{
	...(略)...
}

posted on 2024-09-13 11:33  swj2529411658  阅读(12)  评论(0编辑  收藏  举报

导航