#include<iostream> #include<algorithm> #include<string.h> #include<map> using namespace std; typedef long long ll; int month[]={31,28,31,30,31,30,31,31,30,31,30,31}; int day[10]; void bef(){ for(int i=0;i<10;++i)day[i]=365; for(int i=0;i<12;++i){ for(int j=1;j<=month[i];++j){ --day[(j%10+10-1)%10]; --day[(j%10+10+1)%10]; } } } int main() { bef(); int t; for(cin>>t;t--;){ string s; cin>>s; int pos=7; while(!isdigit(s[pos]))--pos; //cout<<s[pos]<<endl; cout<<day[s[pos]-'0']<<endl; } return 0; } |
Double click to view unformatted code.