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:谁能找出我代码的错,我就,嫁给他……

Posted by RamenGoddess at 2010-03-24 20:17:57 on Problem 1750
In Reply To:谁能找出我代码的错,我就,嫁给他…… Posted by:highspeed at 2010-03-24 19:51:24
> #include<iostream>
> #include<cstdio>
> #include<cstdlib>
> #include<cstring>
> using namespace std;
> 
> char a[100001][11];
> int len[100001],dot[100001],i;
> int main()
> {
> 	//printf("NOTE: For reading convenience spaces are replaced with '.' characters. Your output file should contain spaces instead.\n");
>     scanf("%s",a[0]);
> 	len[0]=strlen(a[0]);
> 	dot[0]=0;
> 	printf("%s\n",a[0]);
> 	int k=0;
> 	i=1;
> 	while(scanf("%s",a[i])!=EOF)
> 	{
> 		len[i]=strlen(a[i]);
> 		int t=0;
> 		for(int j=0;j<len[i]&&j<len[i-1];j++)
> 			if(a[i][j]==a[i-1][j])
> 				t++;
> 			else break;
> 			if(t>dot[i-1])
> 				dot[i]=dot[i-1]+1;
> 			else
> 				dot[i]=t;
> 			for(int j=0;j<dot[i];j++)
> 				printf(".");
> 			printf("%s\n",a[i]);
> 			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