Above average

Hello,
I came up with this solution to this problem on Kattis, however it is passing only the first (standard) test.
can any one help me figure what might be the problem with my solution that prevented it from passing the second test.
Thanks,

problem: above average problem

my solution:
#include < iostream >
using namespace std;
int main() {
int C, k,p;
double nos[50],marks[1000];
double sum,g;
cin>> C;
for (k=0;k<C;k++){
cin>>nos[k];
sum=0;
g=0;
for(p=0;p<nos[k];p++){
cin>>marks[p];
sum+=(double)marks[p]/(double)nos[k];
}
for(p=0;p<nos[k];p++){
if (marks[p]>sum)
g++;
}
printf("%.3lf%%\n", (double) g/(double)nos[k] * 100.0);
}
return 0;
}