SHARE
TWEET

Untitled

Horikita_Suzune May 25th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top