結果

問題 No.358 も~っと!門松列
ユーザー TatsuDXTatsuDX
提出日時 2016-09-03 14:40:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 1,000 ms
コード長 729 bytes
コンパイル時間 3,531 ms
コンパイル使用メモリ 77,896 KB
実行使用メモリ 54,168 KB
最終ジャッジ日時 2024-04-27 15:20:37
合計ジャッジ時間 6,324 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
53,896 KB
testcase_01 AC 114 ms
53,876 KB
testcase_02 AC 109 ms
52,968 KB
testcase_03 AC 100 ms
52,508 KB
testcase_04 AC 109 ms
53,532 KB
testcase_05 AC 118 ms
54,004 KB
testcase_06 AC 108 ms
52,972 KB
testcase_07 AC 115 ms
54,136 KB
testcase_08 AC 113 ms
54,004 KB
testcase_09 AC 112 ms
54,112 KB
testcase_10 AC 117 ms
53,688 KB
testcase_11 AC 120 ms
53,880 KB
testcase_12 AC 115 ms
53,780 KB
testcase_13 AC 117 ms
53,884 KB
testcase_14 AC 108 ms
52,892 KB
testcase_15 AC 109 ms
53,740 KB
testcase_16 AC 99 ms
52,756 KB
testcase_17 AC 98 ms
53,252 KB
testcase_18 AC 107 ms
53,884 KB
testcase_19 AC 116 ms
54,168 KB
testcase_20 AC 113 ms
53,800 KB
testcase_21 AC 102 ms
53,308 KB
testcase_22 AC 112 ms
53,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a, b, c, cnt = 0;
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		if (a == b || b == c || c == a) {
			System.out.println(0);
			return;
		}
		if (Math.max(Math.max(a, b), c) == b || Math.min(Math.min(a, b), c) == b) {
			System.out.println("INF");
			return;
		}
		int ta, tb, tc;
		for (int i = 3, j = Math.max(a, c); i <= j; i++) {
			ta = a % i;
			tb = b % i;
			tc = c % i;
			if (ta == tb || tb == tc || tc == ta) {
				continue;
			}
			if (Math.max(Math.max(ta, tb), tc) == tb || Math.min(Math.min(ta, tb), tc) == tb) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}
0