#include <iostream> #include <string> #include <vector> #include <algorithm> #include <stack> #include <map> #include <queue> #include <cmath> using namespace std; int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; bool isleap(int year) { if (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) { return true; } return false; } int main() { int year, month, day, m; while (scanf("%d", &m) != EOF) { // 注意 while 处理多个 case for (int j = 0; j < m; j++) { scanf("%d%d%d", &year, &month, &day); if (isleap(year)) { days[2] = 29; } else { days[2] = 28; } int count = 0; for (int i = 0; i < month; i++) { count += days[i]; } count += day; printf("%d\n", count); } } } // 64 位输出请用 printf("%lld")