結果

問題 No.1806 Rotating Golem
ユーザー kusirakusirakusirakusira
提出日時 2022-02-09 17:12:12
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 5,220 KB
実行使用メモリ 43,956 KB
最終ジャッジ日時 2023-09-07 02:35:21
合計ジャッジ時間 4,406 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
42,176 KB
testcase_01 AC 78 ms
42,156 KB
testcase_02 AC 74 ms
42,196 KB
testcase_03 AC 75 ms
42,068 KB
testcase_04 AC 74 ms
42,196 KB
testcase_05 AC 74 ms
42,336 KB
testcase_06 AC 75 ms
42,120 KB
testcase_07 AC 76 ms
42,240 KB
testcase_08 AC 76 ms
42,116 KB
testcase_09 AC 74 ms
42,040 KB
testcase_10 AC 77 ms
42,220 KB
testcase_11 AC 74 ms
42,024 KB
testcase_12 AC 74 ms
41,920 KB
testcase_13 AC 74 ms
42,068 KB
testcase_14 AC 75 ms
43,956 KB
testcase_15 AC 74 ms
42,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

const main = ls => {
    const A = ls.splice(0,2);
    A.map((a,i)=>{
        switch (a) {
            case "N":
            A[i]=0;
                break;
            case "E":
            A[i]=1;
                break;
            case "S":
            A[i]=2;
                break;
            case "W":
            A[i]=3;
                break;
        }
    })
    if(A[1]-A[0]>=0){
        console.log(A[1]-A[0]);
    }else{
        console.log(4+(A[1]-A[0]));
    }    
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n'));
0