Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

想知道为什么会CE。。。。求大神解答

Posted by NJUhyc at 2017-04-18 21:13:27 on Problem 2282
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;
char*str = new char[100000001];
int main()
{
	int a, b;
	while (cin >> a >> b&&!(a==0&&b==0))
	{
		int sum[10];
		for (int i = 0;i < 10;i++) sum[i] = 0;
		for (int i = a;i <= b;i++)
		{
			itoa(i, str, 10);
			for (int t = 0;t < strlen(str);t++)
				sum[str[t]-'0']++;
		}
		
		cout << sum[0];
		for (int k = 1;k < 10;k++) cout << " " << sum[k];
		cout << endl;
	}
	delete[] str;
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator