ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1263. Elections

WA on test #12 can someone help me ?
Posted by stilkobg 9 Apr 2008 22:40
#include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
double a[10001];
int main()
{
int l=0,i,n,k;
double x,m;
cin>>n>>m;
for(i=0;i<m;i++)
{
cin>>k;
a[k]++;
}
for(i=1;i<=n;i++)
{
x=a[i]/m;
x*=100;
if(ceil(x)==floor(x))cout<<x<<".00%"<<endl;
else
cout<<setprecision(4)<<x<<'%'<<endl;
}
return 0;
}

Edited by author 09.04.2008 22:50
Re: WA on test #12 can someone help me ?
Posted by Moein Fatehi 13 Oct 2011 16:36
I have this Problem too.
plz help, my program is been written in JAVA.

Edited by author 13.10.2011 16:36
Re: WA on test #12 can someone help me ?
Posted by SButterfly 25 Oct 2012 12:46
So, I have this problem too. What is the rigth solution?

---
I found the answer, use Console.WriteLine("{0:f2}%", t);

Edited by author 25.10.2012 19:37

Edited by author 25.10.2012 19:37
Re: WA on test #12 can someone help me ?
Posted by NiF 26 Oct 2012 18:36
Try these inputs:
2 11
1
2
2
2
2
2
2
2
2
2
2
Re: WA on test #12 can someone help me ?
Posted by nikusha_barbaqa[FreeUni] 1 Mar 2013 00:55
I change this >> first multiply 100 and then divide m . and it works.
Re: WA on test #12 can someone help me ?
Posted by Rodion 24 Jul 2021 22:27
didnt help me