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

这题我用getchar终于过了。。。测试数据黑的一B

Posted by Eov_Second at 2016-12-07 13:57:09 on Problem 1000
main(){
	int a[2] = {};
	int index = 0;
	int bfirstNoneBlank = 0;
	char c;
	while((c=getchar())!=-1){
		if(' '==c||'\t'==c)
			index = bfirstNoneBlank;
		else if('\n'==c){
			if(bfirstNoneBlank){
				printf("%d\n",a[0]+a[1]);
				index = 0;
				a[0] = 0;
				a[1] = 0;
				bfirstNoneBlank = 0;
			}
		}
		else {
		    bfirstNoneBlank = 1;
		    a[index] *= 10;
		    a[index] += c - '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