結果
問題 | No.358 も~っと!門松列 |
ユーザー | ぴろず |
提出日時 | 2016-04-17 22:34:16 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 125 ms / 1,000 ms |
コード長 | 699 bytes |
コンパイル時間 | 2,246 ms |
コンパイル使用メモリ | 75,040 KB |
実行使用メモリ | 41,756 KB |
最終ジャッジ日時 | 2024-04-15 02:18:59 |
合計ジャッジ時間 | 5,693 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
41,496 KB |
testcase_01 | AC | 121 ms
41,396 KB |
testcase_02 | AC | 119 ms
41,492 KB |
testcase_03 | AC | 108 ms
41,504 KB |
testcase_04 | AC | 107 ms
41,196 KB |
testcase_05 | AC | 119 ms
41,428 KB |
testcase_06 | AC | 117 ms
41,368 KB |
testcase_07 | AC | 117 ms
41,532 KB |
testcase_08 | AC | 117 ms
41,500 KB |
testcase_09 | AC | 119 ms
41,536 KB |
testcase_10 | AC | 118 ms
41,372 KB |
testcase_11 | AC | 114 ms
41,492 KB |
testcase_12 | AC | 119 ms
41,208 KB |
testcase_13 | AC | 106 ms
41,756 KB |
testcase_14 | AC | 120 ms
41,280 KB |
testcase_15 | AC | 106 ms
41,644 KB |
testcase_16 | AC | 125 ms
41,488 KB |
testcase_17 | AC | 106 ms
41,508 KB |
testcase_18 | AC | 120 ms
41,228 KB |
testcase_19 | AC | 117 ms
41,472 KB |
testcase_20 | AC | 120 ms
41,672 KB |
testcase_21 | AC | 119 ms
41,628 KB |
testcase_22 | AC | 101 ms
41,616 KB |
ソースコード
package no358; import java.util.Scanner; 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 (isKadomatsuSequence(a, b, c)) { System.out.println("INF"); }else{ int max = Math.max(a, Math.max(b, c)); int count = 0; for(int p=1;p<=max;p++) { if (isKadomatsuSequence(a % p, b % p, c % p)) { // System.out.println(p); count++; } } System.out.println(count); } } public static boolean isKadomatsuSequence(long a,long b,long c) { if (a == b || b == c || a == c) { return false; } return b < a && b < c || b > a && b > c; } }