結果
問題 |
No.1902 AC Ratio
|
ユーザー |
|
提出日時 | 2023-04-11 19:12:54 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 74 ms / 2,000 ms |
コード長 | 1,302 bytes |
コンパイル時間 | 3,382 ms |
コンパイル使用メモリ | 79,336 KB |
実行使用メモリ | 51,232 KB |
最終ジャッジ日時 | 2024-10-07 13:23:09 |
合計ジャッジ時間 | 4,264 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
ソースコード
import java.io.*; import java.util.*; import java.util.stream.*; // 処理 final class Process { private final String S; Process(final String S) { this.S = S; } // 結果を出力 final void printResult(final PrintWriter printWriter) throws IOException { final int[] numbers = Stream.of(S.split("/")).mapToInt(Integer::parseInt).toArray(); final int correctCount = numbers[0]; final int questionCount = numbers[1]; printWriter.println((double)correctCount / questionCount); } } 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(); } }