Guest User

Untitled

a guest
Nov 17th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. // CuttingBitString.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <cmath>
  7. using namespace std;
  8.  
  9. char x[51];
  10. long long put[24], sum;
  11. int i, j, k, sumeTot;
  12. int main()
  13. {
  14. cin.getline(x, 51);
  15. int p=strlen(x);
  16. int puteri=1;
  17. put[1]=1;
  18. while(put[puteri]!=11920928955078125LL)
  19. {
  20. puteri++;
  21. put[puteri]=put[puteri-1]*5;
  22. }
  23. for(i=0; i<p; i++)
  24. {
  25. for(j=0; j<p; j++)
  26. {
  27. sum=0;
  28. for(k=j; k>=i; k--)
  29. {
  30. sum+=pow((double)2, (double)k-i)*(x[k]-48);
  31. //cout<<sum<<"\n";
  32. }
  33. for(k=1; k<=puteri; k++)
  34. {
  35. if(sum==put[k] && sum!=0)
  36. {
  37. a[i][j]=1;
  38. }
  39. if(sum>put[k])
  40. break;
  41. }
  42. }
  43. }
  44. if(sumeTot)
  45. cout<<sumeTot;
  46. else
  47. cout<<-1;
  48. }
Add Comment
Please, Sign In to add comment