結果
問題 | No.358 も~っと!門松列 |
ユーザー |
![]() |
提出日時 | 2017-05-04 13:59:35 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 54 ms / 1,000 ms |
コード長 | 1,204 bytes |
コンパイル時間 | 2,317 ms |
コンパイル使用メモリ | 77,096 KB |
実行使用メモリ | 50,376 KB |
最終ジャッジ日時 | 2024-09-14 07:05:43 |
合計ジャッジ時間 | 4,379 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import static java.lang.System.in;public class Main {public static void main(String[] args) throws IOException {BufferedReader reader = new BufferedReader(new InputStreamReader(in));String[] inputs = reader.readLine().split(" ");int A1 = Integer.parseInt(inputs[0]);int A2 = Integer.parseInt(inputs[1]);int A3 = Integer.parseInt(inputs[2]);int max = Math.max(Math.max(A1, A2), A3);int counter = 0;if (isKadomatu(A1, A2, A3)) {System.out.println("INF");} else {for (int i = 1; i <= max; i++) {if (isKadomatu(A1 % i, A2 % i, A3 % i)) {counter += 1;}}System.out.println(counter);}}private static boolean isKadomatu(int a, int b, int c) {if (a == b || b == c || c == a) {return false;}if (b < a && b < c) {return true;} else if (a < b && c < b) {return true;} else {return false;}}}