| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 116905 | 陈家宝 | 九连环 | C++ | Accepted | 100 | 0 MS | 260 KB | 512 | 2023-12-20 13:54:27 |
#include<bits/stdc++.h> using namespace std; void down(int x); void up(int x); string dp[350]; int o=0; void down(int x) { if(x>2)down(x - 2); o++; dp[o]=dp[o - 1]; dp[o][x-1]='0'; if(x>2)up(x-2); if(x>1)down(x-1); } void up(int x) { if(x>1)up(x-1); if(x>2)down(x-2); o++; dp[o]=dp[o-1]; dp[o][x-1]='1'; if(x>2)up(x-2); } signed main() { int n; dp[0]="111111111"; down(9); while(cin>>n){ if(n>341)cout<<-1<<'\n'; else cout<<dp[n]<<'\n'; } return 0; }