Skip to content

Instantly share code, notes, and snippets.

@godtaehee
Created January 17, 2019 16:32
Show Gist options
  • Save godtaehee/a33db3ff08f0349e3b5116b8498674f2 to your computer and use it in GitHub Desktop.
Save godtaehee/a33db3ff08f0349e3b5116b8498674f2 to your computer and use it in GitHub Desktop.
C
#include <stdio.h>
int main(){
int T, N, avg;
int sum = 0;
scanf("%d", &T);
while(T--){
scanf("%d", &N);
if(N < 1 || N > 1000)
break;
int score[N];
int count = 0;
for(int i = 0; i < N; i++){
scanf("%d", &score[i]);
if(score[i] < 0 || score[i] > 100)
return 0;
sum += score[i];
}
avg = sum / N;
sum = 0;
for(int i = 0; i < N; i++){
if(score[i] > avg){
count++;
}
}
printf("%.3lf%%\n", ((double)count / N) * 100);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment