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

Re:哈哈,勉强到了170MS,各位大侠帮看看咋还能更快的?

Posted by wzyxp_123 at 2008-12-31 19:46:58 on Problem 2602
In Reply To:哈哈,勉强到了170MS,各位大侠帮看看咋还能更快的? Posted by:alawing at 2006-12-28 01:33:15
#include<stdio.h>
int main()
{
	char letter[100000][3];
	int num,i;
	int flag=0;
	scanf("%d",&num);
	getchar();
	for(i=0;i<num;i++)
	{
		scanf("%c%*1c%c",&letter[i][0],&letter[i][1]);
getchar();

	}
	for(i=num-1;i>-1;i--)
	{
		letter[i][2]=letter[i][0]+letter[i][1]+flag-48;
		if(letter[i][2]-48>9)
		{
			flag=1;
			letter[i][2]-=10;
		}
		else
			flag=0;
	}
	if(flag)
	{
		printf("%c",'1');
	}
	for(i=0;i<num;i++)
	{
		printf("%c",letter[i][2]);
	}
	printf("\n");
	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