PE 19 Counting Sundays
来源:互联网 发布:mac 安装搜狗输入法 编辑:程序博客网 时间:2024/06/05 19:38
#include<iostream>using namespace std;const int a[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};bool leapYear(int n){return (((n%4==0)&&(n%100!=0))||(n%400==0));}bool isSun(int n){return (n%7==0?true:false);}void solve(){int num,i,j,count;count=0;i=1901;num=1;while(i<2000){int t=(leapYear(i)?1:0);for(j=0;j<12;j++){num+=a[t][j];if(isSun(num))count++;}i++;}cout<<count<<endl;}int main(void){solve();return 0;}
Answer:
171 0 0
- PE 19 Counting Sundays
- Problem 19:Counting Sundays
- 19 Counting Sundays - Project Euler
- Project Euler 19: Counting Sundays
- project euler 19 Counting Sundays
- Counting Sundays
- Project Euler 题解 #19 Counting Sundays
- projecteuler---->problem=19----Counting Sundays
- Project Euler:Problem 19 Counting Sundays
- Problem 19 Counting Sundays (计算星期天)
- Project Euler Problem 19 Counting Sundays
- [projecteuler]Counting Sundays
- Euler: Counting Sundays
- 欧拉项目 第19题 Counting Sundays
- Problem 19 of How many Sundays fell on the first of the month during the twentieth century
- PE
- PE
- PE
- POJ 1789 Truck History (Kruskal 最小生成树)
- 从最简单的实例学习ARM 指令集(三)
- Linux下组播&广播消息小例子
- 100.Same Tree
- 高质量的css--css hack ,行元素,块元素,居中,定位
- PE 19 Counting Sundays
- UVA - 11121 Base -2
- HI3516C3518A3518E3518C安防视频音频传输4GWIFI方案定制开发
- freemark示例代码
- UVA - 10791 Minimum Sum LCM
- 数据结构-栈和队列
- 2014年总结暨2015展望
- hdu 1828 picture
- 网站被k的症状原因有哪些-怎么恢复