求助,数据都对为什么过不了

P1305 新二叉树

希望更丰富的展现?使用Markdown
by lyh0313 @ 2019-04-14 14:42:39


``` #include<stdio.h> #include<string.h> int Find(char s[],char s2[]); void Insert(char s[],int k,char s2[]); int main() { char s[100],s2[3]; int n=0,i=0; scanf("%d",&n); scanf("%s",s); n--; while(n--) { scanf("%s",s2); int k=Find(s,s2); Insert(s,k,s2); } for(i=0;s[i]!='\0';i++) { if(s[i]=='*') continue; putchar(s[i]); } } int Find(char s[],char s2[]) { int i=0; for(i=0;s[i]!='\0';i++) { if(s[i]==s2[0]) return i; } } void Insert(char s[],int k,char s2[]) { int i=0; int n1=strlen(s); for(i=n1-1;i>=k+1;i--) s[i+2]=s[i]; s[k+1]=s2[1]; s[k+2]=s2[2]; } ``` 排版改了下,不会Markdown的弱鸡
by fanatic @ 2019-04-14 14:46:07


希望更丰富的展现?使用Markdown
by SeverusSnape @ 2019-04-14 14:47:02


希望更丰富的展现?使用Markdown
by SeverusSnape @ 2019-04-14 14:47:07


@[lyh0313](/space/show?uid=147391) 我带测试点一进去也是对的,提交一个过不了,第一次遇到这情况
by fanatic @ 2019-04-14 14:47:29


@[fanatic](/space/show?uid=151410) 您的Find函数有可能没有返回值
by GKxx @ 2019-04-14 14:55:26


这道题目是不是有问题啊
by 北冥之子 @ 2019-07-08 19:12:27


我自己写的代码也是这样 T_T
by 北冥之子 @ 2019-07-08 19:13:18


|