我超 好臭的代码 但是非常好理解!
最开始想的是一颗树 他应该最多搜到一定深度就会重复 所以想可以迭代加深
但是后面想了一下不是很保险 就想着是不是可以构成图 那么他最大也就 max(a,b)那么大张图 非常快觉得 bfs 就好了 然后把每个操作跟着一起存进去
```
#includeusing namespace std; const int N =110; const int mod =11451419; #define endl 'n' #define Endl 'n' #define inf 1e18 #define int long long #define fast ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); signed main(){ int a,b,c;cin>>a>>b>>c; int n=max(a,b); int d[N][N]; string s[N][N]; memset(d,-1,sizeof d); queue >q; q.push({0,0}); d[0][0]=0; while(!q.empty()){ auto t=q.front(); q.pop(); if(t.second==c||t.first==c){ cout< b&&d[sum-b][b]==-1)d[sum-b][b]=d[t.first][t.second]+1,q.push({sum-b,b}),s[sum-b][b]=s[t.first][t.second]+"P12"; else if(sum<=b&&d[0][sum]==-1)d[0][sum]=d[t.first][t.second]+1,q.push({0,sum}),s[0][sum]=s[t.first][t.second]+"P12"; } cout<<"impossible"< ```



