結果

問題 No.18 うーさー暗号
ユーザー masuyuumasuyuu
提出日時 2020-09-17 22:12:56
言語 Java19
(openjdk 21)
結果
AC  
実行時間 171 ms / 5,000 ms
コード長 579 bytes
コンパイル時間 2,105 ms
コンパイル使用メモリ 71,664 KB
実行使用メモリ 56,188 KB
最終ジャッジ日時 2023-09-04 07:40:33
合計ジャッジ時間 5,006 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,884 KB
testcase_01 AC 123 ms
55,744 KB
testcase_02 AC 130 ms
55,964 KB
testcase_03 AC 163 ms
55,892 KB
testcase_04 AC 160 ms
55,904 KB
testcase_05 AC 152 ms
56,036 KB
testcase_06 AC 169 ms
55,824 KB
testcase_07 AC 162 ms
55,960 KB
testcase_08 AC 164 ms
56,188 KB
testcase_09 AC 171 ms
56,012 KB
testcase_10 AC 128 ms
55,684 KB
testcase_11 AC 128 ms
55,352 KB
testcase_12 AC 152 ms
56,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] a = s.toCharArray();
		char[] c = {'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'};
		int y = 0;
		for(int i=0;i<a.length;i++) {
			for(int x=0;x<c.length;x++) {
			if(a[i]==c[x]) {
				if(x-i-1<0) {
					y=0;
					while(x-i-1+y<0) {
						y+=c.length;
					}
					System.out.print(c[x-i-1+y]);
				}else {
				System.out.print(c[x-i-1]);
				}
			}
			}
		}
	}
}
0