水题 ZOJ 3876 May Day Holiday
/*
水题:已知1928年1月1日是星期日,若是闰年加1,总天数对7取余判断就好了;
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std; const int MAXN = 1e4 + ;
const int INF = 0x3f3f3f3f;
int cnt[MAXN]; void leap(void)
{
memset (cnt, , sizeof (cnt)); for (int i=; i<=; ++i)
{
if ((i % == && i % != ) || i % == )
cnt[i] = ;
}
} int main(void) //ZOJ 3876 May Day Holiday
{
//freopen ("H.in", "r", stdin); int t; leap ();
scanf ("%d", &t);
while (t--)
{
int year, day;
scanf ("%d", &year); day = (year - ) * ;
for (int i=; i<=year; ++i)
day += cnt[i];
day += ( + + + ); int ans = day % ;
if(ans == ) printf("6\n");
else if(ans == || ans == || ans == || ans == ) printf("5\n");
else if(ans == ) printf("9\n");
else if(ans == ) printf("6\n");
} return ;
}
水题 ZOJ 3876 May Day Holiday的更多相关文章
- 水题 ZOJ 3875 Lunch Time
题目传送门 /* 水题:找排序找中间的价格,若有两个,选价格大的: 写的是有点搓:) */ #include <cstdio> #include <iostream> #inc ...
- 水题 ZOJ 3880 Demacia of the Ancients
题目传送门 /* 水题:) */ #include <cstdio> #include <iostream> #include <algorithm> #inclu ...
- 水题 ZOJ 3869 Ace of Aces
题目传送门 水题,找出出现次数最多的数字,若多个输出Nobody //#include <bits/stdc++.h> //using namespace std; #include &l ...
- ZOJ 3876 May Day Holiday
As a university advocating self-learning and work-rest balance, Marjar University has so many days o ...
- ZOJ 3876 May Day Holiday 蔡勒公式
H - May Day Holiday Description As a university advoc ...
- [ACM_水题] ZOJ 3706 [Break Standard Weight 砝码拆分,可称质量种类,暴力]
The balance was the first mass measuring instrument invented. In its traditional form, it consists o ...
- [ACM_水题] ZOJ 3714 [Java Beans 环中连续m个数最大值]
There are N little kids sitting in a circle, each of them are carrying some java beans in their hand ...
- [ACM_水题] ZOJ 3712 [Hard to Play 300 100 50 最大最小]
MightyHorse is playing a music game called osu!. After playing for several months, MightyHorse disco ...
- ZOJ 2679 Old Bill ||ZOJ 2952 Find All M^N Please 两题水题
2679:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1679 2952:http://acm.zju.edu.cn/onli ...
随机推荐
- java笔记--策略模式和简单工厂模式
策略模式: --如果朋友您想转载本文章请注明转载地址"http://www.cnblogs.com/XHJT/p/3884781.html "谢谢-- 为什么使用:策略模式主要用于 ...
- php substr中文乱码最有效到解决办法 转:http://blog.sina.com.cn/s/blog_49b531af0100esah.html
(2009-07-29 12:29:38) 转载▼ 标签: php substr文乱码 网站开发 it 直接使用PHP函数substr截取中文字符可能会出现乱码,主要是substr可能硬生生的将一 ...
- php自定义函数call_user_func和call_user_func_array详解
看UCenter的时候有一个函数call_user_func,百思不得其解,因为我以为是自己定义的函数,结果到处都找不到,后来百度了一下才知道call_user_func是内置函 call_user_ ...
- 【Hibernate】Hibernate系列4之配置文件详解
映射文件详解 4.1.概述 4.2.主键生成策略 4.3.属性配置 准确映射: 4.4.映射组成关系 4.5.单向多对一映射 4.6.双向多对一关系 4.7.一对一关联关系-基于外键映射 一对一联合m ...
- 【Hibernate】Hibernate系列3之配置文件详解
配置文件详解 3.1.配置文件 连接池性能优化:http://www.cnblogs.com/xdp-gacl/p/4002804.html
- BASH相关
颜色 http://www.cnblogs.com/lr-ting/archive/2013/02/28/2936792.html http://segmentfault.com/q/10100000 ...
- 4.在二元树中找出和为某一值的所有路径[FindPathsInBinaryTree]
[题目]: 输入一个整数和一棵二元树.从树的根结点开始往下访问一直到叶结点所经过的所有结点形成一条路径.打印出和与输入整数相等的所有路径. 例如输入整数22和如下二元树 10 ...
- (转)SQL SERVER的锁机制(四)——概述(各种事务隔离级别发生的影响)
六.各种事务隔离级别发生的影响 修改数据的用户会影响同时读取或修改相同数据的其他用户.即这些用户可以并发访问数据.如果数据存储系统没有并发控制,则用户可能会看到以下负面影响: · 未提交的依赖关系(脏 ...
- Fence Repair(poj 3253)
题意: 有一个农夫要把一个木板钜成几块给定长度的小木板,每次锯都要收取一定费用,这个费用就是当前锯的这个木版的长度 给定各个要求的小木板的长度,及小木板的个数n,求最小费用 提示: 以 3 5 8 5 ...
- Java并发编程:Synchronized及其实现原理
Java并发编程系列: Java 并发编程:核心理论 Java并发编程:Synchronized及其实现原理 Java并发编程:Synchronized底层优化(轻量级锁.偏向锁) Java 并发编程 ...