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

有点明白不过A3B2CCC4AD1232R这个的结果是错的。就WA了

Posted by RUNSLOWLY at 2009-02-19 23:11:31 on Problem 1302 and last updated at 2009-02-19 23:12:16
#include<iostream>
#include<string.h>
using namespace std;
char str[25];
void f(int i,int n)
{
	cout<<"*"<<i;
	if(str[i]=='0' || i>n-1)
		return;
	else
	if(str[i]>='1' && str[i]<='9')
	{
		str[i]--;
		f(i+str[i]-'0'+1,n);
	}
	else
	{
		str[i]=(n-1-i)%10+'0';
		f(i+1,n);
	}
}
int main()
{
	int i,j,n;
	char o[20];
	while(1)
	{
		cin>>o;
		if(strcmp(o,"ENDOFINPUT")==0)
			break;
		cin>>n;
		cin>>str;
		cin>>o;
		f(0,n);
		cout<<str<<endl;
	}
	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