結果

問題 No.358 も~っと!門松列
ユーザー sasukesasuke
提出日時 2016-06-17 03:17:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 1,000 ms
コード長 759 bytes
コンパイル時間 2,093 ms
コンパイル使用メモリ 76,964 KB
実行使用メモリ 41,736 KB
最終ジャッジ日時 2024-04-17 23:04:13
合計ジャッジ時間 5,794 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
41,332 KB
testcase_01 AC 123 ms
41,276 KB
testcase_02 AC 120 ms
41,020 KB
testcase_03 AC 138 ms
41,736 KB
testcase_04 AC 130 ms
41,340 KB
testcase_05 AC 133 ms
41,348 KB
testcase_06 AC 135 ms
41,340 KB
testcase_07 AC 112 ms
41,168 KB
testcase_08 AC 130 ms
41,360 KB
testcase_09 AC 130 ms
41,384 KB
testcase_10 AC 136 ms
41,564 KB
testcase_11 AC 124 ms
41,580 KB
testcase_12 AC 105 ms
41,192 KB
testcase_13 AC 123 ms
39,888 KB
testcase_14 AC 121 ms
41,136 KB
testcase_15 AC 128 ms
41,368 KB
testcase_16 AC 133 ms
41,264 KB
testcase_17 AC 132 ms
41,388 KB
testcase_18 AC 132 ms
41,212 KB
testcase_19 AC 111 ms
41,060 KB
testcase_20 AC 128 ms
41,004 KB
testcase_21 AC 129 ms
41,168 KB
testcase_22 AC 133 ms
41,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long a1 = sc.nextInt();
        long a2 = sc.nextInt();
        long a3 = sc.nextInt();
        long Max=Math.max(Math.max(a1,a2),a3);
        int count =0;
        for(int i=1;i<=Max;i++){
            long b1=a1%i;
            long b2=a2%i;
            long b3=a3%i;
            if(((b1!=b2)&&(b2!=b3)&&(b3!=b1))&&(((b2>b1)&&(b2>b3))||((b2<b1)&&(b2<b3)))){
               count++;
            }              
        }
        if(((a1!=a2)&&(a2!=a3)&&(a3!=a1))&&(((a2>a1)&&(a2>a3))||((a2<a1)&&(a2<a3)))){
            System.out.println("INF");
        }else{
            System.out.println(count);
        }
    }
}
0