Submission #1188237


Source Code Expand

#include <stdio.h>

int num_input(const char *c, const char L[3], const char R[3]) {
    int res=0;
    for (int i=0; c[i]; ++i) {
        if (
                (c[i] == L[0] && c[i+1] == L[1]) ||
                (c[i] == R[0] && c[i+1] == R[1])
        )
            ++i;

        ++res;
    }

    return res;
}

const char S[16][3]={
    "AA", "AB", "AX", "AY",
    "BA", "BB", "BX", "BY",
    "XA", "XB", "XX", "XY",
    "YA", "YB", "YX", "YY"
};

int main() {
    int N;
    char c[1024]={'\0'};

    scanf("%d %s", &N, c);

    int res=1024;
    for (int i=0; i<16; ++i)
        for (int j=i+1; j<16; ++j) {
            int tmp=num_input(c, S[i], S[j]);
            if (res > tmp)
                res = tmp;
        }

    printf("%d\n", res);
    return 0;
}

Submission Info

Submission Time
Task C - コマンド入力
User rsk0315
Language C (GCC 5.4.1)
Score 100
Code Size 765 Byte
Status AC
Exec Time 1 ms
Memory 128 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:29:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %s", &N, c);
     ^

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 45
Set Name Test Cases
All 00_retmax.txt, 00_retmin.txt, 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 02_twothree_00.txt, 02_twothree_01.txt, 02_twothree_02.txt, 02_twothree_03.txt, 02_twothree_04.txt, 02_twothree_05.txt, 02_twothree_06.txt, 02_twothree_07.txt, 02_twothree_08.txt, 02_twothree_09.txt, 02_twothree_10.txt, 02_twothree_11.txt, 02_twothree_12.txt, 02_twothree_13.txt, 02_twothree_14.txt, 02_twothree_15.txt, 02_twothree_16.txt, 02_twothree_17.txt, 02_twothree_18.txt, 02_twothree_19.txt
Case Name Status Exec Time Memory
00_retmax.txt AC 1 ms 128 KB
00_retmin.txt AC 1 ms 128 KB
00_sample_00.txt AC 1 ms 128 KB
00_sample_01.txt AC 1 ms 128 KB
00_sample_02.txt AC 1 ms 128 KB
01_rnd_00.txt AC 1 ms 128 KB
01_rnd_01.txt AC 1 ms 128 KB
01_rnd_02.txt AC 1 ms 128 KB
01_rnd_03.txt AC 1 ms 128 KB
01_rnd_04.txt AC 1 ms 128 KB
01_rnd_05.txt AC 1 ms 128 KB
01_rnd_06.txt AC 1 ms 128 KB
01_rnd_07.txt AC 1 ms 128 KB
01_rnd_08.txt AC 1 ms 128 KB
01_rnd_09.txt AC 1 ms 128 KB
01_rnd_10.txt AC 1 ms 128 KB
01_rnd_11.txt AC 1 ms 128 KB
01_rnd_12.txt AC 1 ms 128 KB
01_rnd_13.txt AC 1 ms 128 KB
01_rnd_14.txt AC 1 ms 128 KB
01_rnd_15.txt AC 1 ms 128 KB
01_rnd_16.txt AC 1 ms 128 KB
01_rnd_17.txt AC 1 ms 128 KB
01_rnd_18.txt AC 1 ms 128 KB
01_rnd_19.txt AC 1 ms 128 KB
02_twothree_00.txt AC 1 ms 128 KB
02_twothree_01.txt AC 1 ms 128 KB
02_twothree_02.txt AC 1 ms 128 KB
02_twothree_03.txt AC 1 ms 128 KB
02_twothree_04.txt AC 1 ms 128 KB
02_twothree_05.txt AC 1 ms 128 KB
02_twothree_06.txt AC 1 ms 128 KB
02_twothree_07.txt AC 1 ms 128 KB
02_twothree_08.txt AC 1 ms 128 KB
02_twothree_09.txt AC 1 ms 128 KB
02_twothree_10.txt AC 1 ms 128 KB
02_twothree_11.txt AC 1 ms 128 KB
02_twothree_12.txt AC 1 ms 128 KB
02_twothree_13.txt AC 1 ms 128 KB
02_twothree_14.txt AC 1 ms 128 KB
02_twothree_15.txt AC 1 ms 128 KB
02_twothree_16.txt AC 1 ms 128 KB
02_twothree_17.txt AC 1 ms 128 KB
02_twothree_18.txt AC 1 ms 128 KB
02_twothree_19.txt AC 1 ms 128 KB