5 solutions
-
1
#define ll long long #include<bits/stdc++.h> using namespace std; int n; void mix(char i,string w){ if(int(i-'0')>n) for(int j=0;j<w.size();j++) cout<<int(w[j]-'0')<<' '; else{ string t=w; w=t+i+t; mix(i+1,w); } } int main(){ system("color F1"); cin>>n; mix('2',"1"); return 0; }
这题可以直接递归解决
-
0
#include<bits/stdc++.h> #define ll long long using namespace std; int n; void mix(char i,string w){ if(int(i-'0')>n) for(int j=0;j<w.size();j++) cout<<int(w[j]-'0')<<' '; else{ string t=w; w=t+i+t; mix(i+1,w); } } int main(){ system("color F1"); cin>>n; mix('2',"1"); return 0; }
- 1
Information
- ID
- 964
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 6
- Tags
- (None)
- # Submissions
- 46
- Accepted
- 15
- Uploaded By