結果

問題 No.358 も~っと!門松列
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-11 03:30:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,020 bytes
コンパイル時間 2,641 ms
コンパイル使用メモリ 72,060 KB
実行使用メモリ 57,840 KB
最終ジャッジ日時 2023-08-16 18:11:06
合計ジャッジ時間 6,056 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 100 ms
55,740 KB
testcase_02 WA -
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 98 ms
55,916 KB
testcase_14 WA -
testcase_15 AC 100 ms
56,200 KB
testcase_16 AC 98 ms
56,240 KB
testcase_17 AC 103 ms
55,500 KB
testcase_18 AC 100 ms
55,940 KB
testcase_19 AC 101 ms
55,720 KB
testcase_20 WA -
testcase_21 AC 102 ms
53,856 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A1 = 10; //sc.nextInt();
        int A2 = 20; //sc.nextInt();
        int A3 = 1; //sc.nextInt();
        if(A1!=A2 && A1!=A3 && A2!=A3){
            if( (A2>A1 && A2>A3) || (A2<A1 && A2<A3) ){
                System.out.println("INF");
            }else{
                int max = Math.max(Math.max(A1,A2),A3) ;
                int c = 0;
                int p = 2;
                while(true){
                    int a1 = A1%p;
                    int a2 = A2%p;
                    int a3 = A3%p;
                    if( ( (a2>a1 && a2>a3) || (a2<a1 && a2<a3) ) && a1!=a3 ){
                        c++;
                    }
                    p++;
                    if(p>max){
                        break;
                    }
                }
                System.out.println(c);
            }
        }else{
            System.out.println(0);
        }
    }
}
0