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 基础模拟题,弄明白题意,不怕麻烦, ...
随机推荐
- ansible API 常用模块
常用模块 用于读取yaml,json格式的文件 from ansible.parsing.dataloader import DataLoader #用于管理变量的类,包括主机,组,扩展等变量 fro ...
- App自动化-python-Unittest框架
TestCase: 一段Testcase代码示例: # -*- coding: utf-8 -*- ''' Created on 2019-6-27 @author: adminstrator ''' ...
- toggleClass(class|fn[,sw])
toggleClass(class|fn[,sw]) 概述 如果存在(不存在)就删除(添加)一个类.直线电机参数 参数 classStringV1.0 CSS类名 class,switchStri ...
- BZOJ 4017 小 Q 的无敌异或 ( 树状数组、区间异或和、区间异或和之和、按位计贡献思想 )
题目链接 题意 : 中文题 分析 : 首先引入两篇写的很好的题解 题解一.题解二 听说这种和异或相关区间求和的问题都尽量按位考虑 首先第一问.按二进制位计贡献的话.那么对于第 k 位而言 其贡献 = ...
- ARM编辑、编译工具
手动编译 编译器问题,肯定是GNU的大名鼎鼎的GCC了,与此相关的什么连接器,汇编器也都包含在内了. 针对arm的GCC,当然就是arm-linux-gcc了,我所用的版本就是友善之臂光盘自带arm- ...
- [Luogu] 国王游戏
https://www.luogu.org/problemnew/show/P1080 按照 a * b 排序 高精度 #include <bits/stdc++.h> using nam ...
- 数据结构实验之链表二:逆序建立链表(SDUT 2117)
题目链接 #include <bits/stdc++.h> using namespace std; struct node { int data; struct node *next; ...
- 正则匹配href标签内容
完整a标签 <a.+?href=\"(.+?)\".*>(.+)</a> 单独href : <a.+?href=\"(.+?)\" ...
- Pytest学习笔记(二) 用例执行规则
在用pytest执行用例时,可以按照如下场景来执行 1.执行目录及其子目录下的所有用例 pytest filename\ 2.执行某一个py文件下的用例 pytest filename.py 3.-k ...
- git push and git pull
原文链接 git push 通常对于一个本地的新建分支,例如git checkout -b develop, 在develop分支commit了代码之后,如果直接执行git push命令,develo ...