Run ID:2609
提交时间:2024-01-15 22:04:10
#include<iostream> using namespace std; int isleapyear(int x){ if(x%400==0||x%4==0&&x%100!=0) return 1; else return 0; } int main(){ int t; cin>>t; while(t--){ int y,m,d; char c1,c2; cin>>y>>c1>>m>>c2>>d; int y2=y+18,ds=0,mld; while(y!=y2){ while(m!=13){ switch(m){ case 1: mld=31; break; case 2: if(isleapyear(y)==1) mld=29; else mld=28; break; case 3: mld=31; break; case 4: mld=30; break; case 5: mld=31; break; case 6: mld=30; break; case 7: mld=31; break; case 8: mld=31; break; case 9: mld=30; break; case 10: mld=31; break; case 11: mld=30; break; case 12: mld=31; break; } while(d!=mld){ d++; ds++; } m++; d=1; ds++; } y++; m=1; } cout<<ds<<endl; } return 0; }