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 wangfengtian at 2008-12-08 20:32:46 on Problem 2498
#include<stdio.h>
#include<string.h>
int main()
{
	int n,i,a[10]={9,3,7,9,3,7,9,3,7},j,sum,d,k,t;
	char b[100000][10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",b[i]);
		for(j=strlen(b[i])-1,t=j,sum=0;j>=0;j--)
			if(b[i][j]!='?')
				sum=sum+(b[i][j]-48)*a[t-j];
			else
				k=j;
		d=sum/10*10+10-sum;

		while(d%a[t-k]!=0)
		{
			d=d+10;
		}
		b[i][k]=d/a[t-k]+48;
		printf("Scenario #%d:\n%s\n\n",i+1,b[i]);
		
	}
	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