Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long n;
- cin>>n;
- vector<int>v;
- while(n!=0){
- int r=n%10;
- n=n/10;
- v.push_back(r);
- }
- int sum=0;
- for(int j=0;j<v.size();j++){
- sum+=(v[j]*pow(2,j));
- }
- cout<<sum<<endl;
- }
Add Comment
Please, Sign In to add comment