#include <iostream> using namespace std; int main() { int Y, M, D; int m; cin >> m; int months[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; while (m--) { cin >> Y >> M >> D; if (Y % 4 == 0 && Y % 100 != 0 || Y % 400 == 0) { months[2] = 29; } else { months[2] = 28; } int count = 0; for (int i = 1; i <= M; i++) { if (i != M) { for (int j = 1; j <= months[i]; j++) { count++; } } else { for (int j = 1; j <= D; j++) { count++; } } } cout << count << endl; } } // 64 位输出请用 printf("%lld")