《算法竞赛入门经典》第三章习题 (2)
为啥所有的输入输出用的时间都是零额
1 #define LOCAL
2 #include<stdio.h>
3 #include<fstream>
4 #include<time.h>
5 using namespace std;
6 #define MAXN 10010
7 char s[MAXN];
8
9 int main()
10 {
11 FILE *fin;
12 fin=fopen("data.txt","r");
13
14 #ifdef LOCAL
15 freopen("dataout.txt","w",stdout);
16 #endif
17
18 double t;
19 while(fgets(s,MAXN,fin)!=NULL)
20 {
21 puts(s);
22 }
23 t=clock()/CLOCKS_PER_SEC;
24 fclose(fin);
25 printf("Time used: %lf",t);
26 return 0;
2 #include<stdio.h>
3 #include<fstream>
4 #include<time.h>
5 using namespace std;
6 #define MAXN 10010
7 char s[MAXN];
8
9 int main()
10 {
11 FILE *fin;
12 fin=fopen("data.txt","r");
13
14 #ifdef LOCAL
15 freopen("dataout.txt","w",stdout);
16 #endif
17
18 double t;
19 while(fgets(s,MAXN,fin)!=NULL)
20 {
21 puts(s);
22 }
23 t=clock()/CLOCKS_PER_SEC;
24 fclose(fin);
25 printf("Time used: %lf",t);
26 return 0;
27 }