Skip to content

Instantly share code, notes, and snippets.

@Leko
Last active December 18, 2015 05:48
Show Gist options
  • Save Leko/5734926 to your computer and use it in GitHub Desktop.
Save Leko/5734926 to your computer and use it in GitHub Desktop.
AOJ 1179 Millennium Time Limit : 8 sec, Memory Limit : 65536 KB
#include <iostream>
#include <string>
#define REP(i, n) for ( int i = 0; i < n; i++ )
using namespace std;
int month[] = {0, 0, 20, 39, 59, 78, 98, 117, 137, 156, 176, 195, 215, 234 };
int year(int y) {
int sum = 0;
for ( int i = 1; i < y; i++ ) {
if ( i%3 == 0 ) sum += 200;
else sum += 195;
}
return sum;
}
int getdate(int y, int m, int d) {
return year(y) + (y%3==0? (m-1)*20 : month[m]) + d;
}
int main() {
int n, y, m, d;
int today = getdate(1000, 1, 1);
// int _today = _old(1000, 1, 1);
cin >> n;
while(n--) {
int sub = 0;
cin >> y >> m >> d;
sub = today - getdate(y, m, d);
cout << sub << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment