Submission #1061514


Source Code Expand

#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
using namespace std;

int main()
{
    int N;

    if (scanf("%d", &N) < 1) return 0;

    char s[101];
    char t[101];

    if (scanf("%s", s) < 1) return 0;
    if (scanf("%s", t) < 1) return 0;

    int match = 0;
    int tmp = 0;
    for (int i = 0; i < N; i++)
    {
        if (tmp == N) break;
        tmp = i;
        for (int j = 0; j < N; j++)
        {
            if (j == 0) match = 0;
            if (s[tmp] != t[j]) break;
            else
            {
                tmp++;
                match++;
            }
        }
    }

    printf("%d\n", 2 * N - match);
    return 0;
}

Submission Info

Submission Time
Task A - Prefix and Suffix
User ShinjiSHIBATA
Language C++14 (GCC 5.4.1)
Score 200
Code Size 687 Byte
Status AC
Exec Time 1 ms
Memory 128 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 9
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt
Case Name Status Exec Time Memory
0_00.txt AC 1 ms 128 KB
0_01.txt AC 1 ms 128 KB
0_02.txt AC 1 ms 128 KB
1_00.txt AC 1 ms 128 KB
1_01.txt AC 1 ms 128 KB
1_02.txt AC 1 ms 128 KB
1_03.txt AC 1 ms 128 KB
1_04.txt AC 1 ms 128 KB
1_05.txt AC 1 ms 128 KB