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:why wa

Posted by alpc02 at 2006-11-18 17:15:05 on Problem 3077
In Reply To:why wa Posted by:042395 at 2006-11-18 17:08:24
> #include<stdio.h>
> #include<string.h>
> int main()
> {
> 	int n,i,m,j,k;
> 	char a[16];
> 	scanf("%d",&n);
> 	for(i=0;i<n;i++)
> 	{scanf("%s",&a);
> 	m=strlen(a);
> 	if(m==1)
> 	{	printf("%s\n",a);
> 	continue;
> 	}
> 	for(k=m-1;k>=0;k--)
> 	{
> 	if(a[k]>='5')
> 		a[k-1]++;
> 	}
> 	if(a[0]>'9')
> 	{	a[0]='0';
>     printf("1");}
> 	for(j=1;j<m;j++)
> 	{	 a[j]='0';}
> 	printf("%s\n",a);
> 	}
> 	return 0;
> }
> 
输入149结果是200吧

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