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 gzw_02 at 2008-07-16 15:52:13 on Problem 2602
In Reply To:Re:哈哈,勉强到了170MS,各位大侠帮看看咋还能更快的? Posted by:CTcoolL at 2008-06-01 14:49:32
> 呃 我拿你的交怎么1922ms? 人品问题?

# include <stdio.h>
# include <string.h>
const int N=1000001;
 
char a[N],b[N],s[N];

int main(){
    int n,i;
	bool pd;
     scanf("%d",&n); 
	 getchar();
		for(i=0;i<n;i++){
			a[i]=getchar();
			getchar();
			b[i]=getchar();
			getchar();
		}
		pd=false;
		s[n]='\0';
		for(i=n-1;i>=0;i--){
			if(pd) {
				s[i]=(a[i]+b[i]+1-'0'-'0')%10+'0';
				if(a[i]+b[i]+1-'0'-'0'>=10)
					pd=true;
				else pd=false;
			}
			else {
				s[i]=(a[i]+b[i]-'0'-'0')%10+'0';
				if(a[i]+b[i]-'0'-'0'>=10)
					pd=true;
				else pd=false;
			}
		}
		puts(s); 
	return 1;
}

我这个也要1522MS,是不是加数据了?

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