# hdu acm-step 1.3.7 排列2

本题题意:给4个数，求所有的4位数组合，按升序打印.

代码如下:

```#include <cstdio>
#include <algorithm>
using namespace std;
int a[4];
bool input()
{
for(int i=0;i<4;i++)scanf("%d",&a[i]);
return a[0]||a[1]||a[2]||a[3];
}
//int a[256][4];
int main()
{
int f1 = 0;
while(input())
{
if(f1)printf("\n");
f1 = 1;
int i=0;
int temp[4];
sort(a,a+4);
for(int i=0;i<4;i++)temp[i]=a[i];

int last = a[0];
int f = 0;
do
{
if(a[0]!=0)
{
if(a[0]!=last&&last!=0)printf("\n");
if(a[0]==last&&f){printf(" ");}
f=1;
for(int i=0;i<4;i++)
printf("%d",a[i]);
last = a[0];
}
}while(next_permutation(a,a+4));
printf("\n");
}
return 0;
}```

## hdu acm 1425 sort(哈希表思想)

sort Time Limit: 6000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25803    Accepted Submission(s): 7764 Problem Description 给你n个整数,请按从大到小的顺序输出其中前m大的数. Input 每组测试数据有两行,第一行有两个数n,m(0<n,m<1000000),第二行包含n个各不相同,且

## HDU ACM 1005 Number Sequence

Number Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 119732    Accepted Submission(s): 29072 Problem Description A number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A

## HDU 4043 FXTZ II （组合数学-排列组合）

FXTZ II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 498    Accepted Submission(s): 266 Problem Description Cirno is playing a fighting game called "FXTZ" with Sanae. Sanae is a ChuShou

## 杭电 HDU ACM Bone Collector （dp 01）

Bone Collector Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 40414    Accepted Submission(s): 16794 Problem Description Many years ago , in Teddy's hometown there was a man who was called "Bo