Submission #4068987


Source Code Expand

#include<stdio.h>
#include<string.h>
#define LEN 50
int Mystrcmp(char *a,char *b,int n)
{
    for(int i=0;b[i];i++)
        if(a[n+i]!='?'&&a[n+i]!=b[i])
            return 0;
    return 1;
}
int main()
{
    char a[LEN],b[LEN];
    gets(a);
    gets(b);
    int lenb = strlen(b);
    int lena = strlen(a);
    int i;
    for(i=lena-lenb;i>=0;i--)
        if(Mystrcmp(a,b,i))
            break;
    if(i>=0)
    {
        for(int j = 0;a[j];j++)
            if(a[j]=='?')
                a[j] = 'a';
        for(int j = 0;b[j];j++)
            a[i++] = b[j];
        puts(a);
    }
    else printf("UNRESTORABLE\n");
}

Submission Info

Submission Time
Task C - Dubious Document 2
User vjudge4
Language C (GCC 5.4.1)
Score 300
Code Size 619 Byte
Status AC
Exec Time 1 ms
Memory 128 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:14:5: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration]
     gets(a);
     ^
/tmp/ccYUHyCh.o: In function `main':
Main.c:(.text.startup+0x25): warning: the `gets' function is dangerous and should not be used.

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 14
Set Name Test Cases
Sample s1.txt, s2.txt
All in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
in01.txt AC 1 ms 128 KB
in02.txt AC 1 ms 128 KB
in03.txt AC 1 ms 128 KB
in04.txt AC 1 ms 128 KB
in05.txt AC 1 ms 128 KB
in06.txt AC 1 ms 128 KB
in07.txt AC 1 ms 128 KB
in08.txt AC 1 ms 128 KB
in09.txt AC 1 ms 128 KB
in10.txt AC 1 ms 128 KB
in11.txt AC 1 ms 128 KB
in12.txt AC 1 ms 128 KB
s1.txt AC 1 ms 128 KB
s2.txt AC 1 ms 128 KB