結果

問題 No.26 シャッフルゲーム
ユーザー ontama_12ontama_12
提出日時 2016-09-28 09:54:03
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 812 bytes
コンパイル時間 30 ms
コンパイル使用メモリ 5,120 KB
実行使用メモリ 39,296 KB
最終ジャッジ日時 2024-04-21 01:31:49
合計ジャッジ時間 1,294 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
38,784 KB
testcase_01 AC 60 ms
38,400 KB
testcase_02 AC 57 ms
38,400 KB
testcase_03 WA -
testcase_04 AC 59 ms
38,656 KB
testcase_05 WA -
testcase_06 AC 56 ms
38,528 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 57 ms
38,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

    ///////////////////////////////// No.26 シャッフルゲーム
    //入力文字読み取り
    var inputall = require('fs').readFileSync('/dev/stdin', 'utf8');


    //すべて受け取り改行で区切って格納
    var inputline = inputall.split("\n");

    //〇印のあるカップ
    var circle = Number(inputline[0]);

    //入れ替える回数
    var changetimes = Number(inputline[1]);

    //入れ替えるカップをそれぞれを空白で区切って格納
    for (var i = 0; i < changetimes; i++) {
        var replacement = inputline[i+2].split(" ").map(Number);
        if (replacement[0] === circle) {  //印のあるカップが入れ替える対象となるとcircleの内容が変更される
            circle =replacement[1]
        }
    }
    
    console.log(circle)
0