-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrikeORspare2.cpp
More file actions
69 lines (64 loc) · 1.74 KB
/
strikeORspare2.cpp
File metadata and controls
69 lines (64 loc) · 1.74 KB
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
61
62
63
64
65
66
67
68
69
//This is the final answer
//https://www.codechef.com/problems/PINS
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=a;i>b;i--)
#define mem(x,a) memset(x,a,sizeof(x));
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tr(i,a) for( typeof(a.begin()) i=a.begin();i!=a.end();i++)
typedef unsigned long long LL;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
template < class T > T multiply( T a, T b ){return a * b;}
template < class T > T larger( T a, T b ){return ( a > b ? a : b );}
template < class T > T smaller( T a, T b ){return ( a < b ? a : b );}
template<class T> T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<class T> T lcm(T a, T b ){return (a*b)/gcd(a,b);}
//Convert int to string
template <typename T> string to_str(T str){stringstream stream; stream << str; return stream.str();}
template <typename T>int to_int(T num){int val; stringstream stream; stream<<num; stream>>val; return val;}
vector<string> split(string &s,char delim){vector<string> elems;stringstream ss(s); string item;while(getline(ss,item,delim)){elems.push_back(item);}return elems;}
map<LL, LL> mp;
map<LL, LL> mpv;
LL n = 100000;
bool isEven(LL n){
return n%2 == 0;
}
void sol(){
mp[1] = 0;
mpv[1] = 0;
FOR(i, 2, n + 1){
LL num = i / 2;
if(!isEven(i)){
num += 1;
}
if(mp.find(num) == mp.end()){
mp[num] = mp[num - 1];
}else{
mp[num] = 1 + mp[num];
}
mpv[i] = mp[num];
}
}
int main(){
int t;
cin>>t;
sol();
while(t--){
int n;
cin>>n;
cout<<1<<" "<<1;
LL mn = mpv[n];
FOR(i, 0, mn){
cout<<0;
}
cout<<endl;
}
return 0;
}