#include <bits/stdc++.h>
using namespace std;
/*
1 1 1 1 1
1 0 1 1 1
1 0 1 0 1
0 0 1 0 1
0 0 1 0 0
*/
int cnt = 0;
int killer(int pos, int n, vector<int> v){
for( auto i : v ){
cout<<i<<' ';
}
cout<<endl;
if( cnt == 1 ) return 0;
if( pos >= n ) return killer(0, n, v);
if( pos == n-1 ){
if( v[0] == 0 ) return killer(0, n, v);
v[0] = 0;
cnt-=1;
return 0;
}
if( v[pos] == 0 ) return killer(pos+1, n, v);
v[pos+1] = 0;
cnt-=1;
return killer(pos+2, n, v);
}
int main(){
int n; cin>>n;
cnt = n;
vector<int> v(n, 1);
killer(0, n, v);
for(int i=0; i<n; i++){
if( v[i] == 1 ) cout<<i+1<<endl;
}
}
https://zerojudge.tw/ShowProblem?problemid=f313```cpp= #include <bits/stdc++.h> using namespace std; /* 2 3 4 1 10 2 -1 5 -1 2 */ int main(){
Nov 2, 2021io優化 cin.tie(0); ios_base::sync_with_stdio(false); String int to string .to_string() 32位元int to binary string stoi()``string a2 = bitset<32>(a).to_string();
Nov 2, 2021https://zerojudge.tw/ShowProblem?problemid=g501 #include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0); ios_base::sync_with_stdio(false); vector<int> v = { {1, 2, 3, 5, 6, 8, 11, 13, 17, 21, 22},
Oct 27, 2021#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; n -= 1; unsigned long long tri[120], side[120]; tri[0] = 1; side[0] = 3;
Oct 19, 2021or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up