基德KID.1412 发表于 2013-1-26 13:31:41

【水题】USACO Friday the Thirteenth

进入USACO要注册才可看题: http://train.usaco.org/usacogate

题目:【翻译版、是别处的网站】http://www.wzoi.org/usaco/13%5C303.asp

SAMPLE INPUT (file friday.in)
20
SAMPLE OUTPUT (file friday.out)
36 33 34 33 35 35 34


历法中的水题,不多说……

/*ID: 1006100071PROG: fridayLANG: C++*/#include <iostream>#include <fstream>#include <algorithm>#include <string>#include <set>//#include <map>#include <queue>#include <utility>#include <iomanip>#include <stack>#include <list>#include <vector>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <ctype.h>using namespace std;int year;    //year表示前i年有多少天int month = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};inline bool isleap (int y){if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0)return true;return false;}inline int days (int y, int m){int j, day = year;for (j = 1; j < m; j++){if (j == 2 && !isleap (1900+y))day += 28;else day += month;}day += 13;return day;}int main(){/*freopen ("friday.in", "r", stdin);freopen ("friday.out", "w", stdout);*/int i, j, n, ans = {0};for (i = 1; i <= 405; i++){if (isleap (1900+i-1))year = year + 366;else year = year + 365;}scanf ("%d", &n);for (i = 0; i < n; i++){for (j = 1; j < 13; j++)ans++;}printf ("%d %d", ans, ans);for (i = 1; i < 6; i++)printf (" %d", ans);printf ("\n");}
页: [1]
查看完整版本: 【水题】USACO Friday the Thirteenth