結果
| 問題 |
No.358 も~っと!門松列
|
| コンテスト | |
| ユーザー |
Tsukasa_Type
|
| 提出日時 | 2018-02-25 01:49:33 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 140 ms / 1,000 ms |
| コード長 | 604 bytes |
| コンパイル時間 | 2,503 ms |
| コンパイル使用メモリ | 74,828 KB |
| 実行使用メモリ | 54,308 KB |
| 最終ジャッジ日時 | 2024-11-06 20:48:47 |
| 合計ジャッジ時間 | 6,299 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if (IsKadomatsu(a,b,c)==true) {System.out.println("INF");}
else {
int total = 0;
int max = Math.max(a,Math.max(b,c));
for (int i=1; i<=max; i++) {
if (IsKadomatsu(a%i,b%i,c%i)==true) {total++;}
}
System.out.println(total);
}
}
static boolean IsKadomatsu (int a, int b, int c) {
if (a!=b && b!=c && a!=c) {
if (a<b&&b>c || a>b&&b<c) {return true;}
}
return false;
}
}
Tsukasa_Type