結果

問題 No.358 も~っと!門松列
ユーザー TatsuDXTatsuDX
提出日時 2016-09-03 14:40:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 1,000 ms
コード長 729 bytes
コンパイル時間 3,322 ms
コンパイル使用メモリ 73,952 KB
実行使用メモリ 56,080 KB
最終ジャッジ日時 2023-08-09 20:50:31
合計ジャッジ時間 7,492 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,652 KB
testcase_01 AC 119 ms
55,596 KB
testcase_02 AC 121 ms
53,552 KB
testcase_03 AC 121 ms
55,404 KB
testcase_04 AC 120 ms
55,720 KB
testcase_05 AC 119 ms
55,780 KB
testcase_06 AC 118 ms
56,028 KB
testcase_07 AC 117 ms
55,936 KB
testcase_08 AC 122 ms
56,080 KB
testcase_09 AC 121 ms
53,660 KB
testcase_10 AC 120 ms
55,764 KB
testcase_11 AC 122 ms
55,400 KB
testcase_12 AC 121 ms
55,792 KB
testcase_13 AC 121 ms
55,632 KB
testcase_14 AC 122 ms
55,620 KB
testcase_15 AC 123 ms
55,616 KB
testcase_16 AC 124 ms
55,632 KB
testcase_17 AC 125 ms
55,884 KB
testcase_18 AC 122 ms
55,656 KB
testcase_19 AC 119 ms
55,764 KB
testcase_20 AC 120 ms
55,676 KB
testcase_21 AC 122 ms
55,444 KB
testcase_22 AC 120 ms
55,636 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