結果

問題 No.18 うーさー暗号
ユーザー yuki-One300yuki-One300
提出日時 2017-12-14 16:06:07
言語 JavaScript
(node v21.7.1)
結果
RE  
実行時間 -
コード長 1,039 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 6,684 KB
実行使用メモリ 46,336 KB
最終ジャッジ日時 2024-04-21 02:03:02
合計ジャッジ時間 2,172 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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