Page 2 of 2

Re: 1225 - Digit Counting

Posted: Sun Oct 26, 2014 10:34 am
by lighted

Code: Select all

Use code tags. Like this
You must print newline after each line. Remove condition if (c < n - 1).

Re: 1225 - Digit Counting

Posted: Tue Nov 04, 2014 7:16 am
by wencey
Why my code get WA?
thank you.

Code: Select all

#include<iostream>
#include<string>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<map>

using namespace std;
int main ( )
{
	int a;
	cin >> a;
	for ( int b = 0; b < a; b++ )
	{
		int ads [ 10 ];
		for ( int i = 0; i < 10; i++ )
		{
			ads [ i ] = 0;
		}
		string Input;
		cin >> Input;
		for ( int i = 0; i < Input.length(); i++ )
		{
			stringstream ss;
			ss << Input[i];
			int bdf;
			ss >> bdf;
			ads [ bdf ]++;

		}
		for ( int i = 0; i < 10; i++ )
		{
			cout << ads[i] << ' ';

		}
		cout << endl;
	}
	return 0;
}

Re: 1225 - Digit Counting

Posted: Tue Nov 04, 2014 3:28 pm
by lighted
Your code doesn't match sample input/output.