-
Notifications
You must be signed in to change notification settings - Fork 0
/
1015_decailun.cpp
117 lines (112 loc) · 2.38 KB
/
1015_decailun.cpp
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef struct node
{
int num;
int de_mark;
int cai_mark;
}student;
bool comp(const student &a,const student &b)
{
if((a.cai_mark+a.de_mark)!=(b.cai_mark+b.de_mark))
{
return((a.cai_mark+a.de_mark)>(b.cai_mark+b.de_mark));
}
else if(a.de_mark !=b.de_mark)
{
return a.de_mark>b.de_mark;
}
else
{
return a.num<b.num;
}
}
int main()
{
int j,k,m,sum,l_mark,h_mark;
student tmp;
cin>>sum;
cin>>l_mark;
cin>>h_mark;
vector<student> lin;
for(int i=0;i<sum;i++)
{
cin>>j>>k>>m;
if(k>=l_mark&&m>=l_mark)
{
tmp.num=j;
tmp.de_mark=k;
tmp.cai_mark=m;
lin.push_back(tmp);
}
}
cout<<lin.size()<<endl;
vector<student> tmp_line;
student tmp1;
for(student &x:lin)
{
if(x.de_mark>=h_mark&&x.cai_mark>=h_mark)
{
tmp1.num=x.num;
tmp1.de_mark=x.de_mark;
tmp1.cai_mark=x.cai_mark;
tmp_line.push_back(tmp1);
}
}
sort(tmp_line.begin(),tmp_line.end(),comp);
for(int q=0;q<tmp_line.size();q++)
{
cout<<tmp_line[q].num<<" "<<tmp_line[q].de_mark<<" "<<tmp_line[q].cai_mark<<endl;
}
tmp_line.clear();
for(student &x:lin)
{
if(x.de_mark>=h_mark&&x.cai_mark<h_mark)
{
tmp1.num=x.num;
tmp1.de_mark=x.de_mark;
tmp1.cai_mark=x.cai_mark;
tmp_line.push_back(tmp1);
}
}
sort(tmp_line.begin(),tmp_line.end(),comp);
for(int q=0;q<tmp_line.size();q++)
{
cout<<tmp_line[q].num<<" "<<tmp_line[q].de_mark<<" "<<tmp_line[q].cai_mark<<endl;
}
tmp_line.clear();
for(student &x:lin)
{
if(x.de_mark<h_mark&&x.cai_mark<h_mark&&x.de_mark>=x.cai_mark)
{
tmp1.num=x.num;
tmp1.de_mark=x.de_mark;
tmp1.cai_mark=x.cai_mark;
tmp_line.push_back(tmp1);
}
}
sort(tmp_line.begin(),tmp_line.end(),comp);
for(int q=0;q<tmp_line.size();q++)
{
cout<<tmp_line[q].num<<" "<<tmp_line[q].de_mark<<" "<<tmp_line[q].cai_mark<<endl;
}
tmp_line.clear();
for(student &x:lin)
{
if(x.de_mark<h_mark&&x.de_mark<x.cai_mark)
{
tmp1.num=x.num;
tmp1.de_mark=x.de_mark;
tmp1.cai_mark=x.cai_mark;
tmp_line.push_back(tmp1);
}
}
sort(tmp_line.begin(),tmp_line.end(),comp);
for(int q=0;q<tmp_line.size();q++)
{
cout<<tmp_line[q].num<<" "<<tmp_line[q].de_mark<<" "<<tmp_line[q].cai_mark<<endl;
}
tmp_line.clear();
}