GeeksforGeeks Solution For Hard Domain .Below You Can Find The Solution Of School Basic ,Easy ,Medium . Or Hackerrank Solution You Can Also Direct Submit Your Solution to Geeksforgeeks Same Problem .You Need to login then you can submit you answers
Problem :- Class Average
Submit Your Solution :- Click Here
Solution :-
#include <iostream>
#include<cmath>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n,i,a=1,b=2,c=0,sum=0;
cin>>n;
int arr[n];
for(i=0;i<n;i++)
cin>>arr[i];
arr[1]=(arr[1]*2)%100;
while(c<n)
{
c=a+b;
a=b;
b=c;
arr[c-1]=(arr[c-1]*c)%100;
c++;
}
for(i=0;i<n;i++)
sum+=arr[i];
cout<<floor(sum/n)<<endl;
}
return 0;
}
Output:-
0 Comments: