Advertisement
Guest User

działa

a guest
Feb 28th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6. int main()
  7. {
  8.     float suma=0;
  9.     string a;
  10.     cin.ignore(2);
  11.     cin>>a;
  12.     for(int i=0;i<a.length();i++)
  13.     {
  14.         suma+=(a[i]-'0')*pow(2,-i-1);
  15.     }
  16.     cout<<suma;
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement