結果
問題 |
No.18 うーさー暗号
|
ユーザー |
![]() |
提出日時 | 2020-02-02 12:52:37 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,053 bytes |
コンパイル時間 | 2,392 ms |
コンパイル使用メモリ | 74,796 KB |
実行使用メモリ | 57,064 KB |
最終ジャッジ日時 | 2024-09-18 20:35:54 |
合計ジャッジ時間 | 5,468 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 13 |
ソースコード
import java.util.Scanner; class Main { public static void main(String[] args) { No0005 no = new No0005(); System.out.println(no.result()); } } class No0005 { 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 No0005() { 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; if (code > 0) { sb.append(Character.getName(code + MIN_CODE)); } else { code %= CHAR_NUM; sb.append(Character.getName(MAX_CODE + code)); } } this.result = sb.toString(); } public String result() { return this.result; } }