ZOJ 3935 2016

简单规律题...没看懂题目直接从输出中找到了规律。

先不管是不是闰年,前后两项的差值会形成一个等差数列,公差是64.。。

输出的时候再判一下闰年即可。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; bool leap(int year)
{
if( (( == year%)&&( != year%)) ||( == year %) )
return ;
return ;
} int main()
{
int c=;
for(int i=; i<=;)
{
if(leap(i)) printf("%d\n",i);
i=i+c;
c=c+;
}
return ;
}
上一篇:CentOS7 mysql 连接不上 :[ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable


下一篇:gerrit使用教程