/// Raihan Ruhin /// CSE, Jahangirnagar University. /// Dhaka-Bangladesh. /// id: raihanruhin (topcoder / codeforces / codechef / uva / uvalive), 3235 (lightoj) /// mail: raihanruhin@ (yahoo / gmail / facebook) /// blog: ruhinraihan.blogspot.com #include<bits/stdc++.h> using namespace std; #define SET(a) memset(a,-1,sizeof(a)) #define CLR(a) memset(a,0,sizeof(a)) #define PI acos(-1.0) #define MOD 1000000007 #define MX 100010 int main() { ios_base::sync_with_stdio(0);cin.tie(0); int tc, kk=1, n, m, x, y, a, b, c; string s; while(cin>>s) { if(s=="#") return 0; n=0; int sl=s.size(); for(int i=0;i<sl;i++) { int p6 = pow(6, sl-i-1), digit; //%)~@?\$ if(s[i]=='%') digit=0; else if(s[i]==')') digit=1; else if(s[i]=='~') digit=2; else if(s[i]=='@') digit=3; else if(s[i]=='?') digit=4; else if(s[i]=='\\') digit=5; else if(s[i]=='$') digit=-1; n+=digit*p6; } cout<< n <<"\n"; } return 0; }
Monday, 7 September 2015
Wacmian Numbers (UVALive 2731, Regionals 2003 >> South Pacific)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment