HDU 1201(水题)
来源:互联网 发布:四平市信访局网络 编辑:程序博客网 时间:2024/06/15 12:39
题意:如题。
#include <cstdio>#include <cstring>int all[13] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };struct Date{ int year, month, day; Date() {} Date(int y, int m, int d) : year(y), month(m), day(d) {} bool isLeap(int _year) { return (_year % 4 == 0 && _year % 100 != 0) || _year % 400 == 0; } int getDay() { bool t; if (!(t = isLeap(year + 18)) && month == 2 && day == 29) return -1; int sum = 17 * 365; for (int i = 1; i < 18; ++i) if (isLeap(year + i)) ++sum; sum += all[month-1]; if (t && month > 2) ++sum; sum += day; sum += 365 - all[month-1]; if (month - 1 < 2 && isLeap(year)) ++sum; sum -= day; return sum; }};int main(){ int T; Date d; scanf("%d", &T); while (T--) { scanf("%d-%d-%d", &d.year, &d.month, &d.day); printf("%d\n", d.getDay()); }}
0 0
- HDU 1201(水题)
- hdu 1201
- hdu 1201
- hdu 1201
- HDU 1201
- hdu 1201
- HDU 1201
- hdu水题
- hdu 水题
- HDU 1201 闰年
- HDU 1201 Fibonacci Again
- HDU 1800(水题!!! @@)
- hdu 1231 DP水题
- HDU 2114 水题
- 水题 hdu 1070 milk
- HDU-1012 水题
- hdu 1029 计数 水题
- HDU-1040(水题)
- poj-2976-Dropping tests-01分数规划
- 8168
- 2014年1月15日 18:07:57
- 通过压缩png图片的方式减少ipa包的尺寸
- 不靠谱的benchmark测试,关于Gatling和JMeter的测试结果验证
- HDU 1201(水题)
- 一些jar包的作用
- List.toArray()
- 一个android应用效果开发引发的惨案(android Home按键)
- svn:Server sent unexpected return value (403 Forbidden) in response to MKACTIVITY
- __attribute__机制介绍
- Java中的DateFormat用法举例
- 如果雨打,就走在雨里,不快不慢
- 今天我升为了高中生