結果

問題 No.18 うーさー暗号
ユーザー yuki-One300yuki-One300
提出日時 2017-12-14 16:05:20
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 1,041 bytes
コンパイル時間 36 ms
コンパイル使用メモリ 6,812 KB
実行使用メモリ 39,664 KB
最終ジャッジ日時 2024-04-21 02:02:59
合計ジャッジ時間 1,359 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//var Word = window.prompt("文字列を入力してください。")
//Main(Word);

function Main(input) {
    // inputにはすべての入力の文字列が与えられるので必要に応じて input.split("\n") などで分割する。
    var code = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A'];
    var S=[];
    var index=[];
    var uncode=[];
    var re = "";

    for(var i=0;i<input.length;i++){
        S[i] = input.charAt(i);
    }

    //var count = S.length/26;

    for(var z=0;z<S.length;z++){
        index[z] = code.indexOf(S[z],0);
        if((index[z]-(z+1)>=0)){
            uncode[z] = code[index[z]-(z+1)];
        }else if((index[z]-(z+1))<0){
            console.log((index[z]-(z+1))%26+26);
            uncode[z] = code[(index[z]-(z+1))%26+26];
        }
    }

    document.getElementById('result').textContent = uncode.join('');
}

// Don't edit this line!
//Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0