| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
1A,700多MS,贴个代码#include<iostream>
#include<cstring>
using namespace std;
/*空格数列表*/
char sp[][12]={""," "," "," "," "," "," "," "," "," "," "};
int cou=0;
char *spa(char *p1,char *p2){
int i;
for(i=0;p1[i]!='\0';i++){
if(p1[i]==p2[i]){
if(i>cou){
return sp[++cou];
}else{
continue;
}
}else{
cou=i;
return sp[cou];
}
}
cou=i;
return sp[cou];
}
int main(){
char dic[15],nex[15];
cin>>dic;
cout<<dic<<endl;//直接输出第一个字符串
while(scanf("%s",&nex)!= EOF){
printf("%s%s\n",spa(dic,nex),nex);
strcpy(dic,nex);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator