| 
 | 
back to boardWA on test #12 can someone help me ? #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 ? 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 ? 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 ? 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  |  
  | 
|