1.头文件
#include <stdio.h> #include <string.h> #include <math.h> #include <time.h> #include <iostream> #include <algorithm> using namespace std; int main() { int i,j,k; freopen("in.txt","r",stdin); printf("%lf\n",clock()/(double)CLOCKS_PER_SEC); return 0; }
2. freopen可以使用,但提交代码时别忘了删除。
3.long long定义 __int64 输入输出。
4.2个问题: 一个提交编译类型 一个是使用while(scanf("")!=EOF) 可以么 64M的数组可以开多大?
第四届题目:
1.高斯日记:计算日期。 答案:1799-07-16

#include <stdio.h> #include <string.h> #include <math.h> #include <time.h> #include <iostream> #include <algorithm> using namespace std; int f[15]={ 31,28,31,30,31,30,31,31,30,31,30,31}; int main() { int i,j,k;int n; freopen("in.txt","r",stdin); //知识点1: 闰年判断! 是闰年,则2月有29天,全年366天。 scanf("%d",&n);int year=1778,yue=1,ri=1;n=n-245; while(n>0){ if((year%4==0 && year%100!=0) || (year%400==0)){ //今年是闰年 ; if(n>=366) { n=n-366; year++; } else break; } else{ if(n>=365){ n=n-365;year++; } else break; } } printf("%d %d\n",year,n); //打印出到多少年,还有多少天,剩下的手算即可。 printf("%lf\n",clock()/(double)CLOCKS_PER_SEC); return 0; }
2.排他平方数

#include <stdio.h> #include <string.h> #include <math.h> #include <time.h> #include <iostream> #include <algorithm> using namespace std; int f[25];