結果

問題 No.358 も~っと!門松列
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-11 03:30:44
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,020 bytes
コンパイル時間 2,194 ms
コンパイル使用メモリ 75,236 KB
実行使用メモリ 41,804 KB
最終ジャッジ日時 2024-05-04 01:50:30
合計ジャッジ時間 5,171 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 93 ms
40,936 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 106 ms
41,000 KB
testcase_14 WA -
testcase_15 AC 95 ms
41,072 KB
testcase_16 AC 106 ms
41,652 KB
testcase_17 AC 99 ms
41,388 KB
testcase_18 AC 93 ms
41,036 KB
testcase_19 AC 108 ms
41,396 KB
testcase_20 WA -
testcase_21 AC 98 ms
41,804 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