解题
运用STL中的next_permutation函数计算排列组合关系
#include "iostream" #include "algorithm" using namespace std; int n; int ans[1001]; int main() { cin >> n; int m = n; int k = 0; while (m != 0) { ans[k++] = m % 10; m = m / 10; } sort(ans, ans + k); do { for (int i = 0; i < k; i++) cout << ans[i]; cout << endl; } while (next_permutation(ans,ans+k)); return 0; }
0.0分
0 人评分
A+B for Input-Output Practice (II) (C语言代码)浏览:990 |
简单的a+b (C语言代码)浏览:335 |
C语言训练-数字母 (C语言代码)浏览:649 |
众数问题 (C语言代码)浏览:821 |
剪刀石头布 (C语言代码)浏览:748 |
1017题解浏览:583 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:785 |
简单的a+b (C语言代码)浏览:414 |
矩阵的对角线之和 (C语言代码)浏览:1344 |
拆分位数 (C语言代码)浏览:514 |