結果

問題 No.358 も~っと!門松列
ユーザー mits58mits58
提出日時 2016-07-02 20:51:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 1,000 ms
コード長 603 bytes
コンパイル時間 2,272 ms
コンパイル使用メモリ 71,344 KB
実行使用メモリ 56,128 KB
最終ジャッジ日時 2023-08-02 06:15:53
合計ジャッジ時間 6,769 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,668 KB
testcase_01 AC 123 ms
55,988 KB
testcase_02 AC 120 ms
55,880 KB
testcase_03 AC 120 ms
56,128 KB
testcase_04 AC 120 ms
55,772 KB
testcase_05 AC 121 ms
55,612 KB
testcase_06 AC 121 ms
55,964 KB
testcase_07 AC 123 ms
55,800 KB
testcase_08 AC 122 ms
55,732 KB
testcase_09 AC 123 ms
55,784 KB
testcase_10 AC 122 ms
55,728 KB
testcase_11 AC 128 ms
55,440 KB
testcase_12 AC 125 ms
55,828 KB
testcase_13 AC 123 ms
55,764 KB
testcase_14 AC 129 ms
55,656 KB
testcase_15 AC 127 ms
55,900 KB
testcase_16 AC 130 ms
55,952 KB
testcase_17 AC 126 ms
55,644 KB
testcase_18 AC 130 ms
55,528 KB
testcase_19 AC 130 ms
55,948 KB
testcase_20 AC 128 ms
55,700 KB
testcase_21 AC 122 ms
54,072 KB
testcase_22 AC 121 ms
56,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			int a1=sc.nextInt();
			int a2=sc.nextInt();
			int a3=sc.nextInt();
			if(a1==a2 || a1==a3 || a2==a3) System.out.println(0);
			else if(a2>a1 && a2>a3 || a2<a1 && a2<a3) System.out.println("INF");
			else{
				int ans=0;
				for(int i=2;i<=Math.max(a1,Math.max(a2,a3));i++){
					int b1=a1%i,b2=a2%i,b3=a3%i;
					if(b1==b2 || b3==b1 || b2==b3) continue;
					if(b2>b1 && b2>b3 || b2<b1 && b2<b3) ans++;
				}
				System.out.println(ans);
			}
		}
	}
}
0