結果

問題 No.358 も~っと!門松列
ユーザー tsunabittsunabit
提出日時 2019-06-02 02:24:09
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 890 bytes
コンパイル時間 4,093 ms
コンパイル使用メモリ 78,508 KB
実行使用メモリ 57,864 KB
最終ジャッジ日時 2023-10-17 22:54:48
合計ジャッジ時間 7,885 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,368 KB
testcase_01 AC 134 ms
57,396 KB
testcase_02 AC 132 ms
57,500 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 132 ms
57,504 KB
testcase_14 WA -
testcase_15 AC 121 ms
56,212 KB
testcase_16 AC 121 ms
56,208 KB
testcase_17 AC 133 ms
57,612 KB
testcase_18 AC 133 ms
57,632 KB
testcase_19 AC 133 ms
57,500 KB
testcase_20 WA -
testcase_21 AC 132 ms
57,392 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

public class No358 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner s = new Scanner(System.in);
        int a1 = s.nextInt(), a2 = s.nextInt(), a3 = s.nextInt();
        int max = Math.max(Math.max(a1, a2), a3);
        int min = Math.min(Math.min(a1, a2), a3);
        
        if(max == a2 | min == a2) {
        	System.out.println("INF");
        }else {
        	int c = 0;
        	for(int i = 2; i <= max; i++) {
        		int temp_max = Math.max(Math.max(a1%i, a2%i), a3%i);
                int temp_min = Math.min(Math.min(a1%i, a2%i), a3%i);
                if((temp_max == a2%i && a1%i != a3%i) | (temp_min == a2%i && a1%i != a3%i)) {
                	c++;
                }
        	}
        	System.out.println(c);
        }
    }
}
0