为啥是0分啊,可是我测试样例是对的啊

P5734 【深基6.例6】文字处理软件

Carriess @ 2024-07-29 20:27:10

#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
    int q;
    char a[1000];
    char c[1000];
    int x,y;
    scanf("%d",&q);
    getchar();
    gets(a);
    for(int i=1;i<=q;i++)
    {
        scanf("%d",&x);
        getchar();
        switch(x)
        {
            case 1:
                gets(c);
                strcat(a,c);
                puts(a);
                break;
            case 2:
                scanf("%d %d",&x,&y);
                a[x+y]='\0';
                strcpy(c,&a[x]);
                strcpy(a,c);
                puts(a);
                break;
            case 3:
                scanf("%d %s",&x,c);
                strcat(c,&a[x]);
                a[x]='\0';
                strcat(a,c);
                puts(a);
                break;
            case 4:
                gets(c);
                char *p=strstr(a,c);
                printf("%d\n",p!=NULL?(int)(p-a):-1);
                break;
        }
    }

    return 0;
} 

by caochenkai @ 2024-07-29 20:41:26

getsputs不是被?了吗


by caochenkai @ 2024-07-29 20:47:14

getsputs不是被禁了吗


by Nina__happy @ 2024-07-30 21:34:12

是WA吗


by yangzijin @ 2024-08-01 21:34:49

gets和puts??


|