36 lines
1021 B
C++
36 lines
1021 B
C++
#include <iostream>
|
|
#include <iomanip>
|
|
#define IS_LEAP_YEAR(y) (((y) % 4 == 0 && (y) % 100 != 0) || (y) % 400 == 0)
|
|
#define TO_INT(x) ((int)(x)-48)
|
|
using namespace std;
|
|
int main(){
|
|
char a[10];
|
|
int y,m,d,o;
|
|
while(cin>>a){
|
|
y = TO_INT(a[0])*1000+TO_INT(a[1])*100+TO_INT(a[2])*10+TO_INT(a[3]);
|
|
if(a[6] == '/'){
|
|
m = TO_INT(a[5]);
|
|
d = a[8] == '\0'?TO_INT(a[7]):(TO_INT(a[7])*10+TO_INT(a[8]));
|
|
} else{
|
|
m = TO_INT(a[5])*10+TO_INT(a[6]);
|
|
d = a[9] == '\0'?TO_INT(a[8]):(TO_INT(a[8])*10+TO_INT(a[9]));
|
|
}
|
|
switch (m){
|
|
case 12:d += 30;
|
|
case 11:d += 31;
|
|
case 10:d += 30;
|
|
case 9:d += 31;
|
|
case 8:d += 31;
|
|
case 7:d += 30;
|
|
case 6:d += 31;
|
|
case 5:d += 30;
|
|
case 4:d += 31;
|
|
case 3:d += IS_LEAP_YEAR(y)?29:28;
|
|
case 2:d += 31;
|
|
default:break;
|
|
}
|
|
cout << d << endl;
|
|
}
|
|
return 0;
|
|
}
|