結果
問題 | No.358 も~っと!門松列 |
ユーザー | htensai |
提出日時 | 2019-11-21 15:28:24 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 128 ms / 1,000 ms |
コード長 | 674 bytes |
コンパイル時間 | 2,178 ms |
コンパイル使用メモリ | 71,640 KB |
実行使用メモリ | 56,420 KB |
最終ジャッジ日時 | 2023-07-31 09:23:50 |
合計ジャッジ時間 | 6,496 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
55,552 KB |
testcase_01 | AC | 122 ms
56,356 KB |
testcase_02 | AC | 126 ms
55,784 KB |
testcase_03 | AC | 123 ms
55,996 KB |
testcase_04 | AC | 122 ms
56,160 KB |
testcase_05 | AC | 122 ms
56,044 KB |
testcase_06 | AC | 122 ms
55,520 KB |
testcase_07 | AC | 123 ms
55,964 KB |
testcase_08 | AC | 122 ms
55,808 KB |
testcase_09 | AC | 128 ms
55,764 KB |
testcase_10 | AC | 122 ms
55,996 KB |
testcase_11 | AC | 122 ms
55,704 KB |
testcase_12 | AC | 122 ms
56,244 KB |
testcase_13 | AC | 121 ms
55,752 KB |
testcase_14 | AC | 122 ms
55,968 KB |
testcase_15 | AC | 124 ms
55,560 KB |
testcase_16 | AC | 127 ms
56,412 KB |
testcase_17 | AC | 126 ms
55,816 KB |
testcase_18 | AC | 123 ms
56,420 KB |
testcase_19 | AC | 123 ms
55,784 KB |
testcase_20 | AC | 123 ms
55,760 KB |
testcase_21 | AC | 123 ms
56,076 KB |
testcase_22 | AC | 126 ms
55,832 KB |
ソースコード
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); } }