1 8 1 1 1 1 1 1 1 1 2 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1
1 1 1 1 2 1 1 2 2 2 1 1 2 2 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 |
#include<iostream> #include<cstring> #include<cstdio> #include <memory> #include<queue> #include<cmath> #include<set> #include<algorithm> using
namespace std; struct
rect { int
num; int
length; int
width; }; bool
cmp(rect r1,rect r2) { return
r1.num<r2.num||r1.num==r2.num&&r1.length<r2.length||r1.num==r2.num&&r1.length==r2.length&&r1.width<r2.width; } int
main( int
argc, char * argv[]) { int
m; cin>>m; while (m--) { int
m,i,a,b,c,t; rect r[1000]; cin>>m; for (i=0;i<m;i++) { cin>>a>>b>>c; if (b<c) {t=b;b=c;c=t;} r[i].num=a; r[i].length=b; r[i].width=c; } sort(r,r+m,cmp); for (i=0;i<m;i++) { if (r[i].num!=r[i+1].num||r[i].length!=r[i+1].length||r[i].width!=r[i+1].width) { cout<<r[i].num<< " " <<r[i].length<< " " <<r[i].width<<endl; } } } return
0; } |
原文地址:http://www.cnblogs.com/52Cyan/p/3699882.html