USACO Section 1.1: Friday the Thirteenth
2014-03-10 05:33
281 查看
/* ID: leetcod3 PROG: friday LANG: C++ */ #include <iostream> #include <fstream> #include <string> #include <map> #include <vector> #include <set> #include <algorithm> #include <stdio.h> #include <queue> #include <cstring> #include <cmath> #include <list> #include <cstdio> #include <cstdlib> #include <limits> #include <stack> using namespace std; ofstream fout ("friday.out"); ifstream fin ("friday.in"); bool leap(int year) { return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0; } int main() { int N; fin >> N; int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int day = 0; vector<int> days(7); for (int i = 1900; i < 1900 + N; i++) { for (int j = 0; j < 12; j++) { days[(day + 12) % 7]++; if (j == 1) day += (leap(i)? 29 : 28); else day += month[j]; } } fout << days[5] << " " << days[6] << " "; for (int i = 0; i < 4; i++) fout << days[i] << " "; fout << days[4] << endl; return 0; }
相关文章推荐
- USACO Section 1.1 Friday the Thirteenth
- USACO Section 1.1 Friday the Thirteenth 解题报告
- USACO Section 1.1 : Friday the Thirteenth
- USACO Section 1.1 Friday the Thirteenth
- USACO Section1.1 Friday the Thirteenth 解题报告
- USACO 1.1 Friday the Thirteenth
- USACO-Section1.1 Friday the Thirteenth【泰勒公式】
- USACO 1.1 Friday the Thirteenth
- USACO-cha1-sec1.1 Friday the Thirteenth
- USACO Section 1.1 Friday the Thirteenth
- usaco/1.1 Friday the Thirteenth
- USACO-Section1.1 Friday the Thirteenth
- Friday the Thirteenth-section1.1
- 【USACO-Chapter1-1.1】【模拟】Friday the Thirteenth
- USACO 1.1 Friday the Thirteenth
- USACO Section 1.1-3 Friday the Thirteenth
- USACO Section 1.1 Friday the Thirteenth
- USACO 1.1 Friday the Thirteenth
- 洛谷 P1202 [USACO1.1]黑色星期五Friday the Thirteenth
- uscao Section 1.1 Friday the Thirteenth