A. A Big Dinner

题目链接:猛戳这儿

题意:求三个数的全排列

AC Code:

 1 #include <cstdio>
 2 #include <cstring>
 3 #include <algorithm>
 4 using namespace std;
 5 long a[10],t;
 6 long cmp(long x,long y){
 7     return x<y;
 8 }
 9 int main(){
10     scanf("%d",&t);
11     for (long i=1;i<=t;++i){
12         for (long j=1;j<=3;++j)
13             scanf("%d",&a[j]);
14         sort(a+1,a+4,cmp);
15         printf("Case #%d:\n",i);
16         do{
17             printf("%d %d %d\n",a[1],a[2],a[3]);
18         }while(next_permutation(a+1,a+4));
19     }
20     return 0;
21 }

By:王桢旭

posted on 2013-07-28 16:52  SCNUACM  阅读(166)  评论(0编辑  收藏  举报

导航