Advertisement
Horikita_Suzune

Untitled

May 25th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4. /*long long mypow(long long b){
  5.  long long c=1;
  6.   for(int i=1;i<=b;i++){
  7.   c=c*7;
  8.  }
  9.  return c;
  10. }*/
  11. int main(){
  12.  char a[8]={'#','%','$','&',92,'~','!','@'};
  13.  long long c[8]={0,1,2,3,4,5,6,-1};
  14.  string s;
  15.  while(cin>>s&&s!="0"){
  16.   long long ans=0;
  17.   for(int i=0;i<s.length();i++){
  18.   for(int j=0;j<8;j++){
  19.    if(s[i]==a[j]){
  20.     ans+=(c[j]*pow(7,s.length()-i-1));
  21.    }
  22.   }
  23.  }cout<<ans<<'\n';
  24.  }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement