标签:span iostream names 排列 clu ace int cin nbsp
1 #include <iostream> 2 using namespace std; 3 int vis[10],ans[10],n; 4 void f(int x) 5 { 6 if (x == n + 1) 7 { 8 for (int i = 1;i <= n;i++) 9 cout << " " << ans[i]; 10 cout << endl; 11 return; 12 } 13 for (int i = 1;i <= n;i++) 14 if (vis[i] == 0) 15 { 16 vis[i] = 1; 17 ans[x] = i; 18 f(x + 1); 19 vis[i] = 0; 20 } 21 22 } 23 int main() 24 { 25 cin >> n; 26 f(1); 27 return 0; 28 }
标签:span iostream names 排列 clu ace int cin nbsp
原文地址:https://www.cnblogs.com/iat14/p/11241641.html