-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapcs2016-03-1.cpp
More file actions
45 lines (45 loc) · 816 Bytes
/
Copy pathapcs2016-03-1.cpp
File metadata and controls
45 lines (45 loc) · 816 Bytes
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
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a;
cin>>a;
int b[a];
int poi=-1;
for(int flaga=0;flaga<a;flaga++){
cin>>b[flaga];
}
for(int flagb=0;flagb<a;flagb++){
for(int flagc=0;flagc<flagb;flagc++){
if (b[flagb]<b[flagc]){
int temp=b[flagb];
b[flagb]=b[flagc];
b[flagc]=temp;
}
}
}
for (int flagd=0;flagd<a;flagd++){
cout<<b[flagd]<<" ";
}
for (int flage=0;flage<a;flage++){
if(b[flage]>=60){
poi=flage;
break;
}
}
if(poi==-1){
cout<<endl;
cout<<b[a-1]<<endl;
cout<<"worst case";
}
else if(poi==0){
cout<<endl;
cout<<"best case"<<endl;
cout<<b[0];
}
else{
cout<<endl;
cout<<b[poi-1]<<endl;
cout<<b[poi];
}
}