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 1263. Elections

I've got WA N2
Posted by tornike 13 Feb 2009 20:34
here is my cpp program it works very good on my pc can you say me what's wrong with my program?


#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
void main(){
int i,n,m,pasuxebi[9999],passes[9999];
double percent;

cin >> n >> m;
for ( i=0;i<m;i++)
cin >> pasuxebi[i];
for (i=0;i<m;i++){
if (passes[pasuxebi[i]]<0) passes[pasuxebi[i]]=0;
passes[pasuxebi[i]]+=1;
}

for (i=1;i<=n;i++){
percent=(double)passes[i]*100/m;
if ((int)percent>=10){
cout.precision (4);}else{cout.precision(3);}
cout << showpoint << percent <<'%' << endl;
}
system("PAUSE");

}

Edited by author 13.02.2009 20:36