結果
問題 | No.358 も~っと!門松列 |
ユーザー | tenten |
提出日時 | 2021-02-10 08:44:30 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 122 ms / 1,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 2,371 ms |
コンパイル使用メモリ | 72,388 KB |
実行使用メモリ | 56,596 KB |
最終ジャッジ日時 | 2023-09-22 01:50:20 |
合計ジャッジ時間 | 6,067 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 121 ms
56,152 KB |
testcase_01 | AC | 118 ms
55,496 KB |
testcase_02 | AC | 117 ms
55,860 KB |
testcase_03 | AC | 118 ms
56,344 KB |
testcase_04 | AC | 118 ms
55,768 KB |
testcase_05 | AC | 118 ms
56,596 KB |
testcase_06 | AC | 118 ms
56,092 KB |
testcase_07 | AC | 118 ms
55,828 KB |
testcase_08 | AC | 119 ms
56,204 KB |
testcase_09 | AC | 118 ms
55,716 KB |
testcase_10 | AC | 118 ms
56,160 KB |
testcase_11 | AC | 118 ms
55,984 KB |
testcase_12 | AC | 119 ms
55,992 KB |
testcase_13 | AC | 116 ms
56,128 KB |
testcase_14 | AC | 117 ms
56,100 KB |
testcase_15 | AC | 118 ms
56,292 KB |
testcase_16 | AC | 118 ms
56,188 KB |
testcase_17 | AC | 118 ms
56,216 KB |
testcase_18 | AC | 118 ms
55,996 KB |
testcase_19 | AC | 117 ms
54,480 KB |
testcase_20 | AC | 118 ms
56,012 KB |
testcase_21 | AC | 117 ms
56,148 KB |
testcase_22 | AC | 122 ms
55,796 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); if (isKadomatsu(a, b, c)) { System.out.println("INF"); return; } int count = 0; for (int i = 3; i <= Math.max(a, Math.max(b, c)); i++) { if (isKadomatsu(a % i, b % i, c % i)) { count++; } } System.out.println(count); } static boolean isKadomatsu(int a, int b, int c) { return (a < b && c < b && a != c) || (a > b && c > b && a != c); } }