#include<iostream> using namespace std; int main() { int y, m,d,i,count=0; bool leap; char ch = '/'; //题中的输入格式 while (cin >> y >> ch >> m >> ch >> d) { int a[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if (y % 4 == 0) //判断闰年 { if (y % 100 == 0) { if (y % 400 == 0) leap = true; else leap = false; } else leap = true; } else leap = false; if (leap) { a[1] = 29; } else { a[1] = 28; } for (i = 0; i < m - 1; i++) { count += a[i]; } count += d; cout << count << endl; count = 0; } return 0; }
C++ HDU 2005 第几天
最新推荐文章于 2019-08-02 11:45:52 发布