(UVA)10370-及格率
#include<stdio.h> int main(){ int time; while (scanf("%d", &time) != EOF){ while (time--){ int num; scanf("%d", &num); float n[1000] = { 0 }, sum = 0; int i; for (i = 0; i < num; i++) { scanf("%f", &n[i]); sum += n[i]; } float average; average = sum / num; float count = 0; for (i = 0; i<num; i++){ if (n[i]>average) count++; } float per; per = (count / num) * 100; printf("%.3f%%\n", per); } } return 0; }
留言
張貼留言