暴力。一年一年判断过去。如果某一年与输入的年份闰年性质相同,并且1月1日是星期几相同,那么输出。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<stack>
using namespace std; bool f(int x)
{
if(x%==) return ;
if(x%==&&x%!=) return ;
return ;
} int main()
{
int n; scanf("%d",&n);
int s=f(n);
int x=;
int now=n+;
int sum=;
while()
{
int t=f(now);
if(t==) sum=sum+;
else sum=sum+;
int g=(x+sum)%; if(t==s&&g==x)
{
printf("%d\n",now);
break;
}
now++;
}
return ;
}

CodeForces 678B The Same Calendar的更多相关文章

  1. Educational Codeforces Round 13 B. The Same Calendar 水题

    B. The Same Calendar 题目连接: http://www.codeforces.com/contest/678/problem/B Description The girl Tayl ...

  2. 【codeforces 760A】Petr and a calendar

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  3. Codeforces Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A. Checking the Calendar(水题)

    传送门 Description You are given names of two days of the week. Please, determine whether it is possibl ...

  4. codeforces C1. The Great Julya Calendar 解题报告

    题目链接:http://codeforces.com/problemset/problem/331/C1 这是第一次参加codeforces比赛(ABBYY Cup 3.0 - Finals (onl ...

  5. Codeforces 760A Petr and a calendar

    题目链接:http://codeforces.com/problemset/problem/760/A 题意:日历需要多少列. #include <bits/stdc++.h> using ...

  6. codeforces B. Calendar 解题报告

    题目链接:http://codeforces.com/problemset/problem/304/B 题目意思:给出两个日期,需要算出这两个日期之间有多少日. 细心模拟就可以了.特别要注意的是,两个 ...

  7. 【63.63%】【codeforces 724A】Checking the Calendar

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  8. Codeforces Round #654 (Div. 2) B. Magical Calendar (结论)

    题意:你需要在长度从\(1\)~\(k\),宽度无限的网格图中造图形(每个点四周必须连通),问最多能造出多少种不同的图形. 题解:感觉没什么好说的,就是画图找规律,如果\(r\ge n\)的话(即没有 ...

  9. codeforces 724

    题目链接: http://codeforces.com/contest/724 A. Checking the Calendar time limit per test 1 second memory ...

随机推荐

  1. redis高级实用特性(1)

    1.安全性 2.主从复制 3.事务处理 4.持久化机制 5.发布订阅消息 6.虚拟内存的使用 安全性:设置客户端连接后进行任何其他指定前需要使用的密码 警告:因为redis速度相当快,所以在一台比较好 ...

  2. mysql建表设置两个默认CURRENT_TIMESTAMP的技巧

    转载:http://blog.163.com/user_zhaopeng/blog/static/166022708201252323942430/   业务场景: 例如用户表,我们需要建一个字段是创 ...

  3. .Net_用控制台程序打印指定行数的三角型(面试题)

    .Net_用控制台程序打印指定行数的三角型(面试题)   下面是一个由*号组成的4行倒三角形图案.要求: 1.输入倒三角形的行数,行数的取值3-21之间,对于非法的行数,要求抛出提示“非法行数!”: ...

  4. (转)用JMX监测JVM的运行参数

    翻译自http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html  用JMX管理你的JVMJMX是Java管理扩展 ...

  5. JPA的介绍

    一.JPA概述 1.JPA是什么? JPA:Java Persistence API:用于对象持久化的 API,JPA是Java EE 5.0 平台标准的 ORM 规范, 使得应用程序以统一的方式访问 ...

  6. HDU 3416 Marriage Match IV

    最短路+最大流 #include<cstdio> #include<cstring> #include<string> #include<cmath> ...

  7. 搭建Mantis 缺陷管理系统

    什么是Mantis MantisBT is a free popular web-based bugtracking system (feature list). It is written in t ...

  8. Codeforces Round #364 (Div. 2) C.They Are Everywhere

    C. They Are Everywhere time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  9. Vowel Counting

    Vowel Counting Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Tota ...

  10. windows下使用git管理github项目

    1. 下载安装msysgithttp://code.google.com/p/msysgit/downloads/list2. 注册github账号3. 生成ssh公钥和私钥ssh-keygen -C ...