|
|
back to boardWhy WA test 6? Posted by Daniil 19 Jan 2014 21:36 #include <iostream> #include <cmath> using namespace std; int main() { int n;int m;int inp; double a[10001]; double fr2,fractpart, intpart; cin>>n>>m; for (int i=0;i<m;++i) { cin>>inp; ++a[inp-1]; } for (int i=0;i<n;++i) { cout.precision(4); fractpart = modf(((a[i]/m)*100.00),&intpart); if (fractpart==0) cout<<(a[i]/m)*100.00<<".00%\n"; else cout<<(a[i]/m)*100.00<<"%"<<"\n"; } return 0; } |
|
|