結果

問題 No.358 も~っと!門松列
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-19 22:44:09
言語 Java19
(openjdk 21)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 910 bytes
コンパイル時間 2,088 ms
コンパイル使用メモリ 72,420 KB
実行使用メモリ 56,260 KB
最終ジャッジ日時 2023-07-25 13:53:18
合計ジャッジ時間 6,606 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,796 KB
testcase_01 AC 127 ms
55,656 KB
testcase_02 AC 127 ms
55,516 KB
testcase_03 AC 125 ms
55,764 KB
testcase_04 AC 125 ms
55,768 KB
testcase_05 AC 125 ms
56,260 KB
testcase_06 AC 125 ms
55,800 KB
testcase_07 AC 123 ms
55,708 KB
testcase_08 AC 128 ms
55,796 KB
testcase_09 AC 128 ms
55,504 KB
testcase_10 AC 126 ms
55,812 KB
testcase_11 AC 128 ms
55,648 KB
testcase_12 AC 127 ms
55,772 KB
testcase_13 AC 130 ms
55,592 KB
testcase_14 AC 129 ms
55,928 KB
testcase_15 AC 127 ms
55,876 KB
testcase_16 AC 126 ms
56,172 KB
testcase_17 AC 126 ms
55,548 KB
testcase_18 AC 126 ms
55,860 KB
testcase_19 AC 127 ms
55,948 KB
testcase_20 AC 132 ms
55,608 KB
testcase_21 AC 126 ms
55,856 KB
testcase_22 AC 127 ms
53,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] a = new int[3];
    for(int i = 0; i < 3; i++) {
      a[i] = sc.nextInt();
    }
    if((a[0] != a[1]) && (a[0] != a[2]) && (a[1] != a[2])) {
      int[] b = a.clone();
      Arrays.sort(b);
      int max = b[2];
      int min = b[0];
      if((a[1] == max) || (a[1] == min)) {
        System.out.println("INF");
      } else {
        int p = 0;
        for(int i = 3; i <= max; i++) {
          int x = a[0] % i;
          int y = a[1] % i;
          int z = a[2] % i;
          int MA = Math.max(x, Math.max(y, z));
          int MI = Math.min(x, Math.min(y, z));
          if((x != y) && (x != z) && (y != z)) {
            if((y == MA) || (y == MI)) p++;
          }
        }
        System.out.println(p);
      }
    } else {
      System.out.println(0);
    }
  }
}
0