|
|
back to boardFind Mistake ( If You Can !!! :D ) int main() { int n , m; cin >> n >> m; int *counter = new int [n]; for ( int i = 0 ; i < m ; i++ ) { int temp; cin >> temp; counter[temp-1]++; } for ( int i = 0 ; i < n ; i++ ) { float result = (float)counter[i] * (float)100 / (float)m; printf ("%.2f%%\n" , result); } delete[] counter; return 0; } (WA On Test 1) Re: Find Mistake ( If You Can !!! :D ) Where is "cout"? Re: Find Mistake ( If You Can !!! :D ) printf() also does the same work as cout<< Re: Find Mistake ( If You Can !!! :D ) I think the problem is from using int*counter.. Try using vector<int>counter(n); instead.. It worked fine when i tested it with the rest of your code |
|
|