প্রবলেমটি পড়ুন এবং বুঝুন
#include<bits/stdc++.h>
using namespace std;
int main()
{
int test,people;
cin>>test;
while(test--)
{
double average=0;
cin>>people;
int value[people],counter=0;
for(int i=0;i<people;i++)
{
cin>>value[i];
average+=value[i];
}
average/=people;
for(int i=0;i<people;i++)
{
if(average<value[i])
counter++;
}
average=(counter*100)/(double)people;
printf("%.3lf%%\n",average);
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int test,people;
cin>>test;
while(test--)
{
double average=0;
cin>>people;
int value[people],counter=0;
for(int i=0;i<people;i++)
{
cin>>value[i];
average+=value[i];
}
average/=people;
for(int i=0;i<people;i++)
{
if(average<value[i])
counter++;
}
average=(counter*100)/(double)people;
printf("%.3lf%%\n",average);
}
return 0;
}
No comments:
Post a Comment