結果

問題 No.358 も~っと!門松列
ユーザー tsunabittsunabit
提出日時 2019-06-02 11:23:53
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,044 bytes
コンパイル時間 5,323 ms
コンパイル使用メモリ 78,052 KB
実行使用メモリ 57,976 KB
最終ジャッジ日時 2023-10-17 22:57:53
合計ジャッジ時間 7,684 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,396 KB
testcase_01 AC 134 ms
57,536 KB
testcase_02 AC 136 ms
57,672 KB
testcase_03 WA -
testcase_04 AC 120 ms
56,128 KB
testcase_05 AC 135 ms
57,404 KB
testcase_06 WA -
testcase_07 AC 135 ms
57,656 KB
testcase_08 WA -
testcase_09 AC 134 ms
57,404 KB
testcase_10 WA -
testcase_11 AC 132 ms
57,400 KB
testcase_12 AC 135 ms
57,384 KB
testcase_13 AC 135 ms
57,664 KB
testcase_14 AC 135 ms
57,656 KB
testcase_15 AC 136 ms
57,360 KB
testcase_16 AC 135 ms
57,488 KB
testcase_17 AC 137 ms
57,368 KB
testcase_18 AC 137 ms
57,444 KB
testcase_19 AC 134 ms
57,380 KB
testcase_20 AC 137 ms
57,456 KB
testcase_21 AC 135 ms
57,400 KB
testcase_22 AC 136 ms
57,308 KB
権限があれば一括ダウンロードができます

ソースコード

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 | a1 == a3) {
        	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 != a2%i && a1%i != a3%i && a2%i != a3%i)) | (temp_min == a2%i && (a1%i != a2%i && a1%i != a3%i && a2%i != a3%i))) {
                	c++;
//                	System.out.println(a1%i + " , " + a2%i + " , " + a3%i);
                }
        	}
        	System.out.println(c);
        }
    }
}
0