USACO 1.2 Friday the Thirteenth
注意闰月的部分细节很多。
/*
ID:Starry21
LANG:C++
TASK:friday
*/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<map>
using namespace std;
#define N 405
int n;
int ans[];
int main()
{
//freopen("friday.in","r",stdin);
//freopen("friday.out","w",stdout);
scanf("%d",&n);
int lw=,m,d=,r;
for(int i=;i<=n;i++)
{
int y=+i-;
if(y%==)
{
if(y%==) r=;
else r=;
}
else if(y%==) r=;
else r=;
//printf("%d %d\n",y,r);
for(m=;m<=;m++)
{
d=d+;
int res=(d+lw-)%;
if(res==) res=;
lw=res;
lw++;lw=lw%;
if(lw==) lw=;
ans[res]++;
if(m==||m==||m==||m==) d=-;
else if(m==||m==||m==||m==||m==||m==||m==) d=-;
else if(m==)
{
if(r) d=-;
else d=-;
}
}
}
printf("%d %d ",ans[],ans[]);
for(int i=;i<;i++)
printf("%d ",ans[i]);
printf("%d\n",ans[]);
return ;
}
USACO 1.2 Friday the Thirteenth的更多相关文章
- USACO Section1.1 Friday the Thirteenth 解题报告
friday解题报告 —— icedream61 博客园(转载请注明出处) -------------------------------------------------------------- ...
- USACO . Friday the Thirteenth
Friday the Thirteenth Is Friday the 13th really an unusual event? That is, does the 13th of the mont ...
- USACO Section 1.1-3 Friday the Thirteenth
Friday the Thirteenth 黑色星期五 13号又是一个星期五.13号在星期五比在其他日子少吗?为了回答这个问题,写一个程序,要求计算每个月的十三号落在周一到周日的次数. 给出N年的一个 ...
- Friday the Thirteenth 黑色星期五 USACO 模拟 超级简单做法
1003: 1.1.3 Friday the Thirteenth 黑色星期五 时间限制: 1 Sec 内存限制: 128 MB提交: 8 解决: 8[提交] [状态] [讨论版] [命题人:外部 ...
- USACO Section 1.1 Friday the Thirteenth 解题报告
题目 题目描述 黑色星期五是否真的是一件不同寻常的事情?按理来说每个月的13号可能是星期一,或者是星期二...或者是星期天,但是黑色星期五的存在让我们不禁开始猜想,难道每个月的13号刚好是星期五的频率 ...
- USACO 1.1.3 Friday the Thirteenth 黑色星期五
Description 13号又是一个星期5.13号在星期五比在其他日子少吗?为了回答这个问题,写一个程序,要求计算每个月的十三号落在周一到周日的次数.给出N年的一个周期,要求计算1900年1月1日至 ...
- JZOJ.1002【USACO题库】1.1.3 Friday the Thirteenth黑色星期五
每日一博第一天! 保持你的决心 题目描述 13号又是星期五是一个不寻常的日子吗? 13号在星期五比在其他日少吗?为了回答这个问题,写一个程序来计算在n年里13 日落在星期一,星期二......星期日的 ...
- USACO Training Section 1.1黑色星期五Friday the Thirteenth
题目描述 13号又是一个星期五.13号在星期五比在其他日子少吗?为了回答这个问题,写一个程序,要求计算每个月的十三号落在周一到周日的次数.给出N年的一个周期,要求计算1900年1月1日至1900+N- ...
- USACO Chapter 1 解题总结
USACO Chapter 1 解题总结 1.1.1 Your Ride Is Here 基本字符串操作,无压力. 1.1.2 Greedy Gift Givers 基础模拟题,弄明白题意,不怕麻烦, ...
随机推荐
- 查看nginx服务器状态
编译安装时使用--with-http_stub_status_module开启状态页面模块 [root@proxy ~]# yum -y install gcc pcre-devel openssl- ...
- 检查多个远程 Linux 系统是否打开了指定端口
如果想检查 50 多台服务器是否打开了指定的端口,该怎么做,要检查所有服务器并不容易,如果你一个一个这样做,完全没有必要,因为这样你将会浪费大量的时间.为了解决这种情况,我使用 nc 命令编写了一个 ...
- 面试必会之ArrayList源码分析&手写ArrayList
简介 ArrayList是我们开发中非常常用的数据存储容器之一,其底层是数组实现的,我们可以在集合中存储任意类型的数据,ArrayList是线程不安全的,非常适合用于对元素进行查找,效率非常高. 线程 ...
- jmeter从文件中读取参数,并实现循环
1. 通过BeanShell Sampler获取csv的行数 import java.io.BufferedReader;import java.io.FileReader;BufferedReade ...
- codeforces997C
Sky Full of Stars CodeForces - 997C On one of the planets of Solar system, in Atmosphere University, ...
- selenium-爬取小说
selenium-爬取小说 1 import requests 2 from bs4 import BeautifulSoup 3 import sys 4 from selenium import ...
- IDEA2019.1.3的安装和破解
上一篇文章我有写过我会尝试安装IDEA(这玩意儿收费啊!),倘若尝试成功以后都会用它编译,很幸运,我安装成功了,所以今天这篇文章我来写安装和破解方法. IDEA界面: 首先我们访问官方网站:htt ...
- python并发——进程间同步和通信
一.进程间同步 对于一些临界资源,不能使用并发无限消耗,就需要设置专门的临界标示,比如锁或者信号量等 from multiprocessing import Process, Lock import ...
- 【Java/csv】一个CSV文件解析类(转载)
/*下文写得不错,值得学习**/ import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayLis ...
- mysql的启动问题
用cmd启动MySQL (net start mysql )时出现(发生系统错误 5. 拒绝访问)这样的错误是因为cmd 权限太低了需要提高cmd权限才行(即使管理员权限) 如下图cmd所示: ...