-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhacker.cpp
More file actions
38 lines (38 loc) · 729 Bytes
/
hacker.cpp
File metadata and controls
38 lines (38 loc) · 729 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
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t,n;
cin>>t;
while(t--)
{
cin>>n;
string str,s;
cin>>str;
int ans=2;
vector<string> v;
for(int i=1;i<n;i++)
v.push_back(str.substr(i)+str.substr(0,i));
for(auto e:v)
cout<<e<<endl;
char str2[n][n];
for(int i=0;i<n;i++)
{
str2[i] = v[i];
}
for(int i=0;i<n;i++)
{
ans = 2;
for(int j=0;j<n;j++)
{
if(ans ==2)
ans = str2[j][i];
else
ans = ans ^ str2[j][i];
}
s = s + to_string(ans);
}
cout<<s<<endl;
}
return 0;
}