結果

問題 No.358 も~っと!門松列
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-25 01:49:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 115 ms / 1,000 ms
コード長 604 bytes
コンパイル時間 1,752 ms
コンパイル使用メモリ 74,784 KB
実行使用メモリ 41,672 KB
最終ジャッジ日時 2024-04-24 12:43:49
合計ジャッジ時間 5,093 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
41,344 KB
testcase_01 AC 113 ms
41,064 KB
testcase_02 AC 105 ms
41,196 KB
testcase_03 AC 113 ms
41,368 KB
testcase_04 AC 111 ms
41,428 KB
testcase_05 AC 112 ms
41,156 KB
testcase_06 AC 101 ms
41,392 KB
testcase_07 AC 115 ms
40,180 KB
testcase_08 AC 110 ms
41,292 KB
testcase_09 AC 110 ms
41,560 KB
testcase_10 AC 105 ms
41,236 KB
testcase_11 AC 111 ms
41,348 KB
testcase_12 AC 101 ms
41,448 KB
testcase_13 AC 115 ms
41,672 KB
testcase_14 AC 113 ms
40,968 KB
testcase_15 AC 113 ms
41,316 KB
testcase_16 AC 110 ms
41,368 KB
testcase_17 AC 102 ms
41,392 KB
testcase_18 AC 111 ms
41,172 KB
testcase_19 AC 103 ms
39,940 KB
testcase_20 AC 111 ms
41,204 KB
testcase_21 AC 104 ms
41,444 KB
testcase_22 AC 101 ms
41,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if (IsKadomatsu(a,b,c)==true) {System.out.println("INF");}
		else {
			int total = 0;
			int max = Math.max(a,Math.max(b,c));
			for (int i=1; i<=max; i++) {
				if (IsKadomatsu(a%i,b%i,c%i)==true) {total++;}
			}
			System.out.println(total);
		}
	}

	static boolean IsKadomatsu (int a, int b, int c) {
		if (a!=b && b!=c && a!=c) {
			if (a<b&&b>c || a>b&&b<c) {return true;}
		}
		return false;
	}
}
0