暴力。一年一年判断过去。如果某一年与输入的年份闰年性质相同,并且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. MBProgressHUD详解

    1,MBProgressHUD常用属性和用法Demo - (void)testMBProgressHUD { NSLog(@"test MBProgressHUD "); /* 要 ...

  2. 【开发笔记】Spring的配置文件

    factory-method竟然写成了destroy-method,害得我运行报错,找原因找了几分钟. 原来我按alt+/来提示代码的时候,有许多可选项,可能一时眼花选错了

  3. Oracle SQL 内置函数大全

    SQL中的单记录函数 1.ASCII 返回与指定的字符对应的十进制数;SQL> select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ...

  4. JQuery简介及HelloWorld

    一.JQuery是什么: -JQuery是一个JavaScript框架. 二.JQuery的优点: –轻量级 –强大的选择器 –出色的 DOM 操作的封装 –可靠的事件处理机制 –完善的 Ajax – ...

  5. CSS BFC(Block Formatting Context)

    BFC是 W3C CSS 2.1 规范中的一个概念Block Formatting Context的缩写即格式化上下文,它决定了元素如何对其内容进行定位,以及与其他元素的关系和相互作用.简单讲,它是提 ...

  6. MFC中spin control使用

    1.绑定spin和edit m_Spin.SetBuddy(GetDlgItem(m_Edit1)); m_Spin.SetRange(0,100); 2.实现数值的增减 双击控件添加消息 void ...

  7. leetcode342合理运用位操作判断4的幂

    Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Gi ...

  8. Educational Codeforces Round 15_D. Road to Post Office

    D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standa ...

  9. LeetCode OJ 160. Intersection of Two Linked Lists

    Write a program to find the node at which the intersection of two singly linked lists begins. For ex ...

  10. 客户端 HttpUtils.java

    package com.http.post; import java.io.ByteArrayOutputStream; import java.io.IOException; import java ...