| ||||||||||
| 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 | |||||||||
瞎提醒,这明明是水题,我来贴个代码In Reply To:居然贡献了4次WA,提醒一点 Posted by:HJWAJ at 2011-02-16 22:51:15
char str[105][105];
int len[105];
int main()
{
int n,i,j,k;
while(scanf("%d",&n),n)
{
int ans=inf;
for(i=1;i<=n;i++)
{
scanf("%s",str[i]);
len[i]=strlen(str[i]);
checkmin(ans,len[i]-1);
}
for(i=1;i<=n;i++)for(j=i+1;j<=n;j++)if(len[i]==len[j])
{
for(k=len[i]-1;k>=0;k--)if(str[i][k]!=str[j][k])break;
checkmin(ans,k);
}
printf("%d\n",ans);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator