UsacoTraining Chapter1.2 Friday the Thirteenth
来源:互联网 发布:钉钉软件的坏处 编辑:程序博客网 时间:2024/06/14 10:14
题目链接:http://train.usaco.org/usacoprob2?a=RYYdrrzDGxL&S=friday
因为只有400年,直接模拟
但是请注意是从1900年开始!
同时usaco严格限制输出长度
/*ID: nflsjxc1TASK: fridayLANG: C++ */#include<bits/stdc++.h>using namespace std;int n;int cal[]={0,31,28,31,30,31,30,31,31,30,31,30,31};int ans[8];int main(){freopen("friday.in","r",stdin);freopen("friday.out","w",stdout);ios::sync_with_stdio(0);//cin.tie(0); //1900!!!!!!!!!!!!!!!!!!cin>>n;n+=1900;int year=1900,month=1,day=1,date=1;while(1){if(year%4==0&&year%100!=0||year%400==0){cal[2]=29;}else{cal[2]=28;}day++;date++;date%=7;if(day==13){ans[date]++;//if(date==6)cout<<year<<' '<<month<<' '<<day<<'\n';}if(year==n-1&&month==12&&day==31)break;if(month>12){month=1;year++;}if(day-cal[month]>0){day-=cal[month];month++;}}for(int i=6;i<=11;i++){cout<<ans[i%7]<<' ';}cout<<ans[12%7]<<'\n';//usaco严格限制输出长度 return 0;}
阅读全文
0 0
- UsacoTraining Chapter1.2 Friday the Thirteenth
- 【USACO-Chapter1-1.1】【模拟】Friday the Thirteenth
- 1.1.2---Friday the Thirteenth
- Friday the Thirteenth
- Analysis:Friday the Thirteenth
- Friday the Thirteenth(USACO)
- usaco--Friday the Thirteenth
- Friday the Thirteenth
- [USACO] Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- usaco Friday the Thirteenth
- Friday the Thirteenth黑色星期五
- USACO Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- Friday the Thirteenth
- 20171218开通博客留贴
- DirectX11笔记(十二)--Direct3D渲染8--EFFECTS
- 基因数据处理57之BWA-MEM运行single-end(1千万条100bp的reads)
- 人群密度估计-Crowd Density
- 斐波那契数列(递归与非递归算法)
- UsacoTraining Chapter1.2 Friday the Thirteenth
- 基因数据处理58之snap运行paired-end(1千万条100bp的reads对)
- Leader Election 选举算法
- 结合redis设计与实现的redis源码学习-26-工具函数(Util.h/.c)
- 冒泡排序(BubbleSort)
- 回归更博通知!!
- Python基础(一)——Anaconda的安装
- zabbix-agent 分发器
- 堆排序原理及算法实现