結果

問題 No.331 CodeRunnerでやれ
ユーザー lunnearlunnear
提出日時 2019-01-21 04:49:34
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,442 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 26,688 KB
実行使用メモリ 91,616 KB
平均クエリ数 62.88
最終ジャッジ日時 2023-09-23 16:44:09
合計ジャッジ時間 9,144 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
24,000 KB
testcase_01 AC 156 ms
23,556 KB
testcase_02 AC 168 ms
24,268 KB
testcase_03 AC 171 ms
23,836 KB
testcase_04 AC 163 ms
24,000 KB
testcase_05 AC 183 ms
24,072 KB
testcase_06 AC 178 ms
24,288 KB
testcase_07 AC 246 ms
23,608 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int main()
{
    enum Mode
    {
        First,
        CheckL,
        Rotate,
    };

    char ins[20];
    int in;
    
    Mode mode = First;

    while(1)
    {
        scanf("%s", ins);
        if(ins[0] == 'M')
            break;
        
        in = atoi(ins);
        
        //  直進でゴール!
        if(in > 20)
        {
            printf("F\n");
            fflush(0);
            continue;
        }
        
        
        
        switch(mode)
        {
        case First:     //  最初は壁に当たるまで直進
        {
            if(in == 0)
            {
                printf("R\n");
                mode = Rotate;
            }
            else
            {
                printf("F\n");
            }
            
            fflush(0);
            break;
        }
        
        case CheckL:    //  左向く
        {
            printf("L\n");
            fflush(0);
            
            mode = Rotate;
            break;
        }
        
        case Rotate:    //  回って進む
        {
            if(in == 0)
            {
                printf("R\n");
                fflush(0);
            }
            else
            {
                printf("F\n");
                fflush(0);
                mode = CheckL;
            }
            
            break;
        }
        
        default:;
        }
    }
    
    return 0;
}
0