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

用cin没问题,贴AC代码

Posted by 15914304086 at 2012-03-11 11:24:39 on Problem 2316
In Reply To:cin和gets会错, 要换成scanf输入!!!!! Posted by:20092462 at 2010-06-05 15:18:06
#include <iostream>
#include <string>
using namespace std;

int main()
{
	string a;
	int *q,d,i;
	cin>>a;
	d=a.length();
	q=new int[d];
	memset(q,0,4*d);
	do
	{
		for (i=0;i<d;i++)
		{
			q[i]+=a[i]-48;
			q[i]%=10;
		}
	}
	while (cin>>a);
	for (i=0;i<d;i++)
		cout<<q[i];
	cout<<endl;
	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