-
Notifications
You must be signed in to change notification settings - Fork 1
/
1077.c
52 lines (50 loc) · 1.19 KB
/
1077.c
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 <stdio.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
#include <stdlib.h>
int process(double a){
int b=a;
a-=b;
if(a>=0.5){
return b+1;
}
else{
return b;
}
}
int main(){
int n,i,j,maxscore;
scanf("%d%d",&n,&maxscore);
for(i=0;i<n;i++){
int studentsc[100]={0},teachersc=0,max=0,min=99999,maxi = 0,mini = 0,t=0;
double avr=0;
scanf("%d",&teachersc);
if(teachersc>maxscore){
teachersc=0;
}
for(j=0;j<n-1;j++){
scanf("%d",&studentsc[j]);
if(studentsc[j]>max&&studentsc[j]<=maxscore&&studentsc[j]>=0){
max=studentsc[j];
maxi=j;
}
if(studentsc[j]<min&&studentsc[j]<=maxscore&&studentsc[j]>=0){
min=studentsc[j];
mini=j;
}
if(studentsc[j]>maxscore){
studentsc[j]=-1;
}
}
for(j=0;j<n-1;j++){
if(j!=maxi&&j!=mini&&studentsc[j]>=0){
avr+=studentsc[j];
t++;
}
}
avr/=t;
printf("%d\n",process((avr+teachersc)/2));
}
return 0;
}