#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int a;
vector < int > num;
while(scanf("%d",&a)){
num.clear();
if(!a)
break;
//scanf("%d",&a);
int fail_max = 0 , pass_min = 999;
for(int j=0 ; j<a ; ++j)
{
int reg;
scanf("%d",®);
if(reg>fail_max && reg<60)
fail_max = reg;
if(reg<pass_min && reg>=60)
pass_min = reg;
num.push_back(reg);
}
sort(num.begin(),num.end());
for(int k=0 ; k<num.size() ; ++k)
{
printf("%d ",num[k]);
}
printf("\n");
if(!fail_max)
printf("best case\n");
else
printf("%d\n",fail_max);
if(pass_min == 999)
printf("worst case\n");
else
printf("%d\n",pass_min);
}
return 0;
}
//why TLE
#include
#include
#include
#include
using namespace std;
int main(){
int a;
vector < int > num;
while(scanf("%d",&a)){
num.clear();
if(!a)
break;
//scanf("%d",&a);
int fail_max = 0 , pass_min = 999;
for(int j=0 ; j {
int reg;
scanf("%d",®);
if(reg>fail_max && reg<60)
fail_max = reg;
if(reg=60)
pass_min = reg;
num.push_back(reg);
}
sort(num.begin(),num.end());
for(int k=0 ; k<num.size() ; ++k)
{
printf("%d ",num[k]);
}
printf("\n");
if(!fail_max)
printf("best case\n");
else
printf("%d\n",fail_max);
if(pass_min == 999)
printf("worst case\n");
else
printf("%d\n",pass_min);
}
return 0;
}
//why TLE
while(scanf("%d", &a) == 1) {
// code
}
然後他嚴格比對
記得行末不要多於空白 0u0