結果
| 問題 | 
                            No.358 も~っと!門松列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-06-02 02:24:09 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 890 bytes | 
| コンパイル時間 | 3,456 ms | 
| コンパイル使用メモリ | 75,720 KB | 
| 実行使用メモリ | 56,024 KB | 
| 最終ジャッジ日時 | 2024-09-17 20:03:59 | 
| 合計ジャッジ時間 | 6,485 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 WA * 13 | 
ソースコード
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);
        }
    }
}