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

我疯了 为什么wa 忘大牛指点(附代码)

Posted by shaohua2208 at 2009-03-25 21:48:26 on Problem 2337
#include<iostream>
using namespace std;
int main()
{
	int m,n;
	int i;
	int k,j;
	int len;
//	freopen("2337.txt","r",stdin);
	char teststr[1005][25];
	cin>>n;
	while(n--){
		k = 0;
		j = 0;
		cin>>m;
		for(i = 0; i < m; i++){
			cin>>teststr[i];
		}
		len = strlen(teststr[0]);
		while(j < m - 1){
			if(teststr[j][len - 1] == teststr[j + 1][0]){
				j++;
				len = strlen(teststr[j]);
				continue;
			}
			else{
				k = 1;
				break;
			}
		}
		if(k == 0){
			for(i = 0; i < m - 1; i++){
				cout<<teststr[i]<<".";
			}
			cout<<teststr[m - 1]<<endl;
		}
		else{
			cout<<"***"<<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