ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1864. Get-Together at Den's

I have WA10!!!
Posted by vakhid 13 Feb 2014 14:18
#include <iostream>

using namespace std;

int main()
{
 int n;
 cin>>n;
 double a[n];
 double s=0;
 for (int i=0;i<n;i++) {cin>>a[i];s+=a[i];}
 double sr=s/(n+1);double p=0;
 for (int i=0;i<n;i++) if (a[i]>sr) {p+=a[i]-sr;}
 for (int i=0;i<n;i++)
 {
 if (a[i]>sr) cout<<(int)(100*(a[i]-sr)/(p-0.0001))<<" ";

 else cout<<"0"<<" ";
 }
    return 0;
}
If you have give me please test 10...
Re: I have WA10!!!
Posted by Ahmadjon 18 Oct 2014 17:27

I think this is right:

if (a[i]>sr) cout<<(int)(100*(a[i]-sr)/p + 1e-10)<<" ";

Edited by author 18.10.2014 17:28