結果

問題 No.18 うーさー暗号
ユーザー syusyu
提出日時 2020-08-26 20:00:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 194 ms / 5,000 ms
コード長 732 bytes
コンパイル時間 2,198 ms
コンパイル使用メモリ 74,792 KB
実行使用メモリ 41,892 KB
最終ジャッジ日時 2024-04-25 03:44:27
合計ジャッジ時間 5,237 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
41,080 KB
testcase_01 AC 131 ms
41,328 KB
testcase_02 AC 144 ms
41,088 KB
testcase_03 AC 180 ms
41,708 KB
testcase_04 AC 172 ms
41,692 KB
testcase_05 AC 171 ms
41,428 KB
testcase_06 AC 180 ms
41,496 KB
testcase_07 AC 194 ms
41,892 KB
testcase_08 AC 191 ms
41,740 KB
testcase_09 AC 179 ms
41,780 KB
testcase_10 AC 141 ms
41,536 KB
testcase_11 AC 149 ms
41,252 KB
testcase_12 AC 165 ms
41,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String word=sc.next();
        
        String[] alphabet={"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"};
        //System.out.println(alphabet.length);=>26でした
        List<String> list=Arrays.asList(alphabet);
        //System.out.println(list.indexOf("B"));
        String[] letters=word.split("");
        for(int i=0;i<letters.length;i++){
            int index=list.indexOf(letters[i])-(i+1);
            while(index<0){
                index+=26;
            }
            System.out.print(list.get(index));
        }
    }
}
0