結果

問題 No.18 うーさー暗号
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 01:28:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 160 ms / 5,000 ms
コード長 396 bytes
コンパイル時間 1,984 ms
コンパイル使用メモリ 76,176 KB
実行使用メモリ 55,196 KB
最終ジャッジ日時 2024-04-09 20:47:58
合計ジャッジ時間 4,631 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
54,492 KB
testcase_01 AC 126 ms
54,532 KB
testcase_02 AC 144 ms
54,992 KB
testcase_03 AC 151 ms
55,196 KB
testcase_04 AC 160 ms
55,180 KB
testcase_05 AC 130 ms
54,248 KB
testcase_06 AC 141 ms
54,760 KB
testcase_07 AC 143 ms
54,616 KB
testcase_08 AC 153 ms
54,864 KB
testcase_09 AC 147 ms
54,872 KB
testcase_10 AC 143 ms
55,060 KB
testcase_11 AC 128 ms
54,356 KB
testcase_12 AC 150 ms
55,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		String ans = "";
		for (int i=0; i<s.length(); i++) {
			int temp = s.charAt(i);
			temp -= 65;
			int minus = (i+1)%26;
			temp -= minus;
			if (temp < 0) {temp += 26;}
			temp += 65;
			ans += (char)temp;
		}
		System.out.println(ans);
	}
}
0