-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpuzzle16b.cpp
More file actions
60 lines (48 loc) · 739 Bytes
/
puzzle16b.cpp
File metadata and controls
60 lines (48 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
int main()
{
string s="11101000110010100";
int len=35651584;
//string s="10000";
//int len=20;
while (s.length() < len)
{
string b="";
for(int i=s.length()-1;i>=0;i--)
{
if (s.at(i) == '0')
{
b += "1";
}
else
{
b += "0";
}
}
s=s + "0" + b;
printf("%i\n", s.length());
//printf("%s\n", s.c_str());
}
s.resize(len);
while (s.length() % 2 == 0)
{
string b = "";
int i = 0;
while (i < s.length())
{
if (s.at(i) == s.at(i+1))
b += "1";
else
b += "0";
i+=2;
}
s = b;
printf("%i\n", s.length());
//printf("%s\n", s.c_str());
}
printf("%s\n", s.c_str());
return 0;
}