結果
問題 | No.358 も~っと!門松列 |
ユーザー |
![]() |
提出日時 | 2019-11-21 15:28:24 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 142 ms / 1,000 ms |
コード長 | 674 bytes |
コンパイル時間 | 4,079 ms |
コンパイル使用メモリ | 75,044 KB |
実行使用メモリ | 54,192 KB |
最終ジャッジ日時 | 2024-10-10 03:04:35 |
合計ジャッジ時間 | 8,468 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
import java.util.*;public class Main {public static void main (String[] args) {Scanner sc = new Scanner(System.in);int max = 0;int a = sc.nextInt();int b = sc.nextInt();int c = sc.nextInt();if ((b > a && b > c && a != c) || (b < a && b < c && a != c)) {System.out.println("INF");return;}max = Math.max(max, a);max = Math.max(max, b);max = Math.max(max, c);int count = 0;for (int i = 3; i <= max; i++) {int pa = a % i;int pb = b % i;int pc = c % i;if ((pb > pa && pb > pc && pa != pc) || (pb < pa && pb < pc && pa != pc)) {count++;}}System.out.println(count);}}