解题思路:
注意事项:
参考代码:
#include <iostream> #include <algorithm> using namespace std; int main(){ int a[4]; for(int i=0;i<4;i++) cin>>a[i]; sort(a,a+4); int b[3]={a[0],a[1],a[2]}; int c[3]={a[0],a[1],a[3]}; int d[3]={a[0],a[2],a[3]}; int e[3]={a[1],a[2],a[3]}; do{ cout<<b[0]<<" "<<b[1]<<" "<<b[2]<<endl; } while(next_permutation(b,b+3)); do{ cout<<c[0]<<" "<<c[1]<<" "<<c[2]<<endl; } while(next_permutation(c,c+3)); do{ cout<<d[0]<<" "<<d[1]<<" "<<d[2]<<endl; } while(next_permutation(d,d+3)); do{ cout<<e[0]<<" "<<e[1]<<" "<<e[2]<<endl; } while(next_permutation(e,e+3)); return 0; }
0.0分
5 人评分
十->二进制转换 (C语言代码)浏览:1291 |
printf基础练习2 (C语言代码)浏览:305 |
兰顿蚂蚁 (C++代码)浏览:1045 |
WU-蓝桥杯算法提高VIP-交换Easy (C++代码)浏览:1119 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:476 |
C语言程序设计教程(第三版)课后习题8.4 (C语言代码)浏览:609 |
sizeof的大作用 (C语言代码)浏览:1451 |
愚蠢的摄影师 (C++代码)浏览:938 |
Hello, world! (C语言代码)浏览:714 |
模拟计算器 (C++代码)浏览:806 |