結果
問題 | No.18 うーさー暗号 |
ユーザー | kitamoto0407 |
提出日時 | 2023-03-26 05:19:24 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 48 ms / 5,000 ms |
コード長 | 1,372 bytes |
コンパイル時間 | 4,100 ms |
コンパイル使用メモリ | 74,284 KB |
実行使用メモリ | 37,352 KB |
最終ジャッジ日時 | 2024-09-19 07:19:55 |
合計ジャッジ時間 | 3,411 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
ソースコード
import java.io.*; // 処理 final class Process { private final String S; Process(final String S) { this.S = S; } // 結果を出力 final void printResult(final PrintWriter printWriter) throws IOException { // 65: A, 90: Z for(int s = 0; s < S.length(); s++) { int charCode = (int)S.charAt(s) - (s + 1); if(charCode < 65) { while(charCode < 65) { charCode += 26; } } printWriter.print((char)charCode); } printWriter.println(); } } public class Main { public static void main(final String[] args) throws IOException { final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); final PrintWriter printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); // 入力 final String S = bufferedReader.readLine().trim(); // Process クラスで処理を行う final Process process = new Process(S); process.printResult(printWriter); // 各ストリームを閉じる // 出力ストリームを閉じるときに標準出力に文字を出力する bufferedReader.close(); printWriter.close(); } }