Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CuttingBitString.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <cmath>
- using namespace std;
- char x[51];
- long long put[24], sum;
- int i, j, k, sumeTot;
- int main()
- {
- cin.getline(x, 51);
- int p=strlen(x);
- int puteri=1;
- put[1]=1;
- while(put[puteri]!=11920928955078125LL)
- {
- puteri++;
- put[puteri]=put[puteri-1]*5;
- }
- for(i=0; i<p; i++)
- {
- for(j=0; j<p; j++)
- {
- sum=0;
- for(k=j; k>=i; k--)
- {
- sum+=pow((double)2, (double)k-i)*(x[k]-48);
- //cout<<sum<<"\n";
- }
- for(k=1; k<=puteri; k++)
- {
- if(sum==put[k] && sum!=0)
- {
- a[i][j]=1;
- }
- if(sum>put[k])
- break;
- }
- }
- }
- if(sumeTot)
- cout<<sumeTot;
- else
- cout<<-1;
- }
Add Comment
Please, Sign In to add comment