-
个人简介
#include<bits/stdc++.h> using namespace std; int main(){ long long n; cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ for(int m=1;m<=n;m++){ if(i!=j && i!=m && j!=m) cout<<i<<" "<<j<<" "<<m<<endl; } } } return 0; }
代一升是我
爸爸儿子#include<bits/stdc++.h> using namespace std; int a[100],v[100],n; void dfs(int step){ if(step==n+1){ for(int i=1;i<=n;i++) cout<<setw(5)<<a[i]; cout<<endl; return ; } for(int i=1;i<=n;i++){ if(v[i]==0){ a[step]=i; v[i]=1; dfs(step+1); v[i]=0; } } } int main(){ cin>>n; dfs(1); return 0; }
-
通过的题目
-
最近活动
This person is lazy and didn't join any contests or homework.
题目标签
- 循环嵌套
- 1
- GESP二级
- 1