请教一道简单题
今晚的ICPC/ACM上海站热身赛1008题,(杭电4018题)http://acm.hdu.看起来很简单的一道题,AC率也很高,但我反复submit,反复wrong answer~~~纠结了很久,不知道是不是理解错了题意
有AC的把代码亮出来看看~~,第一个贴上的得全分
2011-09-07 23:26
程序代码:#include<stdio.h>
#include<stdlib.h>
#define MAXSIZE 200
int main()
{
int num,i;
char * *str,*ch;
scanf("%d",&num);
str=(char **)malloc(num*sizeof(char*));
for(i=0;i<num;++i)
{
str[i]=(char *)malloc(MAXSIZE*sizeof(char));
scanf("%s",str[i]);
}
for(i=0;i<num;i++)
{
ch=str[i];
while(*ch!='/')
ch++;
ch+=2;
printf("Case #%d: ",i+1);
while(*ch!='/'&&*ch!=':')
{
printf("%c",*ch);
ch++;
}
printf("\n");
}
return 1;
}
4562718 2011-09-08 00:04:45 Accepted 4018 0MS 160K 487 B C czstoday
2011-09-08 00:05

2011-09-08 00:22
2011-09-08 00:29
2011-10-13 21:41
程序代码:#include<stdio.h>
char str[100];
int main()
{
int T,i,test=1;
scanf("%d",&T);
while(T--)
{
scanf("%s",str);
printf("Case #%d: ",test++);
for(i=0;str[i]!=':';i++);i=i+3;
while(str[i]!='/' && str[i]!=':' && str[i]!='\0')
printf("%c",str[i++]);
printf("\n");
}
return 0;
}

2011-10-13 21:45
2011-10-13 22:10
2011-10-14 07:20