文章
84
粉丝
408
获赞
33
访问
872.3k
#include<iostream>
using namespace std;
int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool add_day(int y)
{
if (y%400 == 0)
return true;
else if (y%100 != 0 && y%4 == 0)
return true;
else
return false;
}
int main()
{
int n;
cin >> n;
while (n--) {
int y, m, d;
cin >> y >> m >> d;
int sum = 0;
for (int i = 1; i < m; i++) {
if (i == 2 && add_day(y))
sum += days[i] + 1;
else
sum += days[i];
}
sum += d;
cout << sum << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发