|
|
back to boardHELP!!!!! Do anybody know what is mistake: #include<iostream> #include<vector> using namespace std; int main() { int n,m; cin>>n>>m; vector<int> a,b,count; a.resize(m); b.resize(n); count.resize(n); for(int i=0;i<m;i++){ cin>>a[i];} for(int i=0;i<n;i++){ b[i]=i+1; count[i]=0;} for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(b[i]==a[j]){ count[i]++;}}} vector<float> c; c.resize(n); for(int i=0;i<n;i++){ if(count[i]>0){ c[i]=m/count[i]; c[i]=100/c[i]; cout.precision(2); cout<<fixed<<c[i]<<"%"<<endl;} else{ c[i]=count[i]; cout.precision(2); cout<<fixed<<c[i]<<"%"<<endl;}} return 0; }
I got WA#3 Re: HELP!!!!! Posted by Rockman 17 Mar 2009 13:40 I HAVE WA N12.did you thinked about 0.00% percent ? |
|
|