結果

問題 No.18 うーさー暗号
ユーザー SagTokiSagToki
提出日時 2018-05-07 14:45:48
言語 Java19
(openjdk 21)
結果
AC  
実行時間 175 ms / 5,000 ms
コード長 801 bytes
コンパイル時間 3,917 ms
コンパイル使用メモリ 74,148 KB
実行使用メモリ 57,252 KB
最終ジャッジ日時 2023-09-10 10:53:48
合計ジャッジ時間 6,620 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
56,888 KB
testcase_01 AC 153 ms
56,524 KB
testcase_02 AC 154 ms
57,252 KB
testcase_03 AC 173 ms
56,868 KB
testcase_04 AC 160 ms
56,652 KB
testcase_05 AC 171 ms
56,760 KB
testcase_06 AC 168 ms
56,876 KB
testcase_07 AC 172 ms
57,096 KB
testcase_08 AC 175 ms
56,988 KB
testcase_09 AC 174 ms
56,872 KB
testcase_10 AC 154 ms
56,524 KB
testcase_11 AC 153 ms
56,600 KB
testcase_12 AC 171 ms
56,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class UsaCord {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String InputText =scanner.next(); //暗号化する文字列
        String CipherText = ""; //暗号化後のデータ格納
        int RepetitionNumber = 0; //繰り返し数の定義
       
         for(int i=0 ; i<InputText.length() ; i++){
            RepetitionNumber = i + 1;
            
            char no = (char) RepetitionNumber; //繰り返し数だけ文字をずらす
            int num = InputText.charAt(i) - no;
            while(num <= 64){
                num = num + 26;
            }
            CipherText = CipherText + 
                    ((char)num);  
         }           
        System.out.println(CipherText);
    }
}
0