結果
問題 | No.18 うーさー暗号 |
ユーザー |
![]() |
提出日時 | 2020-02-02 13:16:30 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,096 bytes |
コンパイル時間 | 2,174 ms |
コンパイル使用メモリ | 74,648 KB |
実行使用メモリ | 41,580 KB |
最終ジャッジ日時 | 2024-09-18 20:36:59 |
合計ジャッジ時間 | 3,883 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 12 |
ソースコード
import java.util.Scanner; class Main { public static void main(String[] args) { No0018 no = new No0018(); System.out.println(no.result()); } } class No0018 { public static int MIN_CODE = Character.getNumericValue('A'); public static int MAX_CODE = Character.getNumericValue('Z'); public static int CHAR_NUM = MAX_CODE - MIN_CODE + 1; private String s; private String result; public No0018() { Scanner sc = new Scanner(System.in); this.s = sc.next(); StringBuffer sb = new StringBuffer(""); for (int i = 0; i < this.s.length(); i++) { int code = this.s.codePointAt(i) - MIN_CODE + 1; code = code - (i + 1); if (code > 0) { sb.append(Character.toChars(MIN_CODE + code - 1)); } else { code %= CHAR_NUM; sb.append(Character.toChars(MAX_CODE - code)); } } this.result = sb.toString(); } public String result() { return this.result; } }