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

求助

Posted by Andimeo at 2008-11-24 14:06:53 on Problem 3340
#include<stdio.h>
#include<string.h>
#include<math.h>

char s1[100],s2[100];

int main(void)
{
	while(scanf("%s",s1) && strcmp(s1,"#"))
	{
		scanf("%s",s2);
		int i;
		bool small=false,big = false,equal = true;
		long long result = 0 ;
		int num_of_que = 0;
		for(i=0;s1[i];i++)
		{
			if(s1[i] == '?')
				num_of_que++;
		}
		if(num_of_que==0)
		{
			if(strcmp(s1,s2)>0)
				puts("1");
			else
				puts("0");
			continue;
		}
		for(i=0;s1[i];i++)
		{
			if(s1[i]!='?')
			{
				if(s1[i]>s2[i] && !small)
				{
					big = true;
					equal = false;
				}
				if(s1[i] < s2[i] && !big)
				{
					small = true;
					equal = false;
				}
			}
			else
			{
				if(big)
				{
					result += (long long)pow(10.0,num_of_que*1.0);
					break;
				}
				if(equal)
				{
					result += ('9'-s2[i])*(long long)pow(10.0,(num_of_que-1)*1.0);
				}
				num_of_que--;
			}
		}
		printf("%lld\n",result);
	}
	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