結果

問題 No.358 も~っと!門松列
ユーザー nCk_cvnCk_cv
提出日時 2016-04-20 16:26:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 1,000 ms
コード長 684 bytes
コンパイル時間 2,173 ms
コンパイル使用メモリ 75,432 KB
実行使用メモリ 54,380 KB
最終ジャッジ日時 2024-04-15 03:53:47
合計ジャッジ時間 6,273 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
54,184 KB
testcase_01 AC 143 ms
54,296 KB
testcase_02 AC 139 ms
54,264 KB
testcase_03 AC 138 ms
54,324 KB
testcase_04 AC 135 ms
54,068 KB
testcase_05 AC 138 ms
54,212 KB
testcase_06 AC 140 ms
54,340 KB
testcase_07 AC 138 ms
53,972 KB
testcase_08 AC 138 ms
54,140 KB
testcase_09 AC 143 ms
54,064 KB
testcase_10 AC 139 ms
54,000 KB
testcase_11 AC 135 ms
54,164 KB
testcase_12 AC 139 ms
54,344 KB
testcase_13 AC 137 ms
54,336 KB
testcase_14 AC 137 ms
54,152 KB
testcase_15 AC 139 ms
53,948 KB
testcase_16 AC 136 ms
54,276 KB
testcase_17 AC 138 ms
54,120 KB
testcase_18 AC 135 ms
54,056 KB
testcase_19 AC 140 ms
54,028 KB
testcase_20 AC 139 ms
53,780 KB
testcase_21 AC 139 ms
54,264 KB
testcase_22 AC 143 ms
54,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
 
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(check(a,b,c)) {
			System.out.println("INF");
			return;
		}
		int MAX = Math.max(a, Math.max(b, c));
		int count = 0;
		for(int i = 1; i <= MAX; i++) {
			if(check(a % i, b % i, c % i)) {
				count++;
			
			}
		}
		System.out.println(count);
	}
	static boolean check(int a, int b, int c) {
		return a != b && b != c && a != c &&  ((a < b && c < b) || (a > b && c > b));
	}
 
	
}
0