結果

問題 No.18 うーさー暗号
ユーザー bigbear90560bigbear90560
提出日時 2015-07-04 23:56:59
言語 Java19
(openjdk 21)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 661 bytes
コンパイル時間 3,862 ms
コンパイル使用メモリ 72,372 KB
実行使用メモリ 56,324 KB
最終ジャッジ日時 2023-09-21 11:48:49
合計ジャッジ時間 6,139 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
56,324 KB
testcase_01 AC 113 ms
53,592 KB
testcase_02 AC 113 ms
55,760 KB
testcase_03 AC 118 ms
55,720 KB
testcase_04 AC 112 ms
56,092 KB
testcase_05 AC 115 ms
55,688 KB
testcase_06 AC 114 ms
56,004 KB
testcase_07 AC 115 ms
55,568 KB
testcase_08 AC 116 ms
55,608 KB
testcase_09 AC 114 ms
56,000 KB
testcase_10 AC 113 ms
55,960 KB
testcase_11 AC 112 ms
55,936 KB
testcase_12 AC 113 ms
55,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

/**
 * No.18 うーさー暗号
 */
public class USACipher {

	public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        // 文字列をchar型配列に分解
        char[] ca = s.toCharArray();
        StringBuilder sb = new StringBuilder();
        
        int Cnt = 1;
        for (int c : ca) {
        	sb.append((char) ( (c - Cnt)<65? c - Cnt + 26: c - Cnt));
        	Cnt++;
        	if (Cnt > 26) Cnt = 1;
        }
        System.out.println(sb.toString());

	}

}
0