1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| #include<iostream> #include<vector> #include<map> #include<set>
#define debug(x) cout<<#x<<": "<<x<<','; #define el cout<<endl; #define pb(x) push_back(x)
using namespace std;
map<char,int> m={{'A',10},{'B',11},{'C',12},{'D',13},{'E',14},{'F',15},{'G',16},{'H',17},{'J',18},{'K',19},{'L',20},{'M',21},{'N',22},{'P',23},{'Q',24},{'R',25},{'S',26},{'T',27},{'U',28},{'V',29},{'X',30},{'Y',31},{'W',32},{'Z',33},{'I',34},{'O',35}}; int times[]={1,9,8,7,6,5,4,3,2,1,1};
signed main(){ string s,tmp="";int ans=0; cin>>s; tmp+=to_string(m[s[0]]); for(int i=1;i<s.length();i++){ tmp+=s[i]; } s=tmp; for(int i=0;i<s.length();i++){ ans+=(int(s[i])-48)*times[i] ; } int l; while(cin>>l&&l!=0){ if(l==1){ cout<<s<<endl; } if(l==2){ cout<<ans<<endl; } if(l==3){ if(ans%10)cout<<0<<endl; else cout<<1<<endl; } } return 0; }
|