結果
| 問題 |
No.358 も~っと!門松列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-06-02 11:23:53 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,044 bytes |
| コンパイル時間 | 3,120 ms |
| コンパイル使用メモリ | 78,400 KB |
| 実行使用メモリ | 54,324 KB |
| 最終ジャッジ日時 | 2024-09-17 20:06:38 |
| 合計ジャッジ時間 | 6,221 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 WA * 4 |
ソースコード
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);
}
}
}