【CodeForces】678B
来源:互联网 发布:没有海绵的文胸知乎 编辑:程序博客网 时间:2024/05/16 15:21
http://codeforces.com/problemset/problem/678/B
给定一个年份,求下一个与给定年份完全相同的年份。
完全相同指该年的第一天是周几与当前年是周几完全一样,而且必须是闰年和闰年或者平年和平年。
#include <bits/stdc++.h>using namespace std;int y,Y;int d=0;bool is(int y){ if ((y%4==0&&y%100!=0)||y%400==0) return true; return false;}int main(){ cin >> y; Y=y; while (1){ if (is(y)) d+=2; //366%7==2 else d+=1; //365%7==1 d%=7; y++; if (d==0&&is(Y)==is(y)){ cout << y << endl; exit(0); } }}
阅读全文
0 0
- 【CodeForces】678B
- codeforces B
- codeforces B
- codeforces B
- codeforces B
- Codeforces 678B Remainders Game(数论)
- CodeForces 626B CodeForces 626B【暴力】
- CodeForces 841B (B) 博弈
- codeforces 134B
- codeforces#98 b
- codeforces 105 div2 B
- Codeforces 166B - Polygons
- codeforces B. Coins
- codeforces----193B Xor
- codeforces----208B Solitaire
- Codeforces 1B - Spreadsheet
- codeforces 214B Hometask
- Codeforces Round #136 B
- linux安装
- JAVA内部类
- 级联删除报Cannot delete or update a parent row: a foreign key constraint fails解决方法
- 删除字符串中间的空格
- Eclipse注释模板设置详解
- 【CodeForces】678B
- IE无法解析返回的JSON格式并提示下载文件
- mvc5中
- MySQL数据库基本操作指南(单表操作v1.2)
- 计算梯度的方法
- 小ho的01串
- MVC3 Razor模板引擎 @RenderBody、@RenderPage、@RenderSection及Html.RenderPartial、Html.RenderAction
- 51nod 1278 相离的圆 二分+排序
- QAQ & 火星情报局