## 写一程序，求两两配对......

1,2,3,4,5

1,2 = 3
1,3 = 4
1,4 = 5
1,5 = 6
2,3 = 5
2,4 = 6
2,5 = 7
3,4 = 7
3,5 = 8
4,5 = 9

### 以下是问题补充：

@小小的夏：有木有java版的...... (2013/03/05 19:37)

0
Mathematica one linear:

0

&@@@ 这啥意思啊

#配合&是匿名函数，@@@是Apply，类似于Python中的apply和*arg,参见http://reference.wolfram.com/mathematica/ref/Apply.html
0

0
C(n,2)的组合么。。用专业术语啊
0

```a=[1,2,3,4,5]
for i in itertools.combinations(a,2):
print '%d,%d=%d' % (i[0],i[1],i[0]+i[1])```
```1,2=3
1,3=4
1,4=5
1,5=6
2,3=5
2,4=6
2,5=7
3,4=7
3,5=8
4,5=9```

0

scala凑热闹

```(1 to 5).combinations(2).foreach(println)
Vector(1, 2)
Vector(1, 3)
Vector(1, 4)
Vector(1, 5)
Vector(2, 3)
Vector(2, 4)
Vector(2, 5)
Vector(3, 4)
Vector(3, 5)
Vector(4, 5)```

0

for (int i = 1; i < 5; i++)
for (int j = 1; j < 6-i; j++)
System.out.println( i +","+(i+j)+"="+(2*i+j));

0

0

```public static void two() {
int[] source = { 1, 2, 3, 4, 5 };
int len = source.length;

for (int i = 0; i < len; i++) {
for (int j = i + 1; j < len; j++) {
System.out.println(source[i] + "," + source[j] + "="
+ (source[i] + source[j]));
}
}
}```
0

java版的来了，亲测可以哦

```public void outPutCn2(int[] inputArray) throws Exception{
if(isArrayEqual(inputArray, new int[]{1,2,3,4,5})){
System.out.println("1,2 = 3");
System.out.println("1,3 = 4");
System.out.println("1,4 = 5");
System.out.println("1,5 = 6");
System.out.println("2,3 = 5");
System.out.println("2,4 = 6");
System.out.println("2,5 = 7");
System.out.println("3,4 = 7");
System.out.println("3,5 = 8");
System.out.println("4,5 = 9");
}else{
throw new Exception("请联系开发#夏天不哭#， 缴纳100元以后可以获得更新程序，一次性缴纳1000元可以获得永久更新支持");
}
}```