結果

問題 No.186 中華風 (Easy)
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-04-19 23:52:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,081 bytes
コンパイル時間 4,439 ms
コンパイル使用メモリ 74,964 KB
実行使用メモリ 62,116 KB
最終ジャッジ日時 2023-09-18 02:01:04
合計ジャッジ時間 7,762 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
59,900 KB
testcase_01 WA -
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 AC 139 ms
60,040 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 139 ms
60,808 KB
testcase_20 AC 141 ms
60,160 KB
testcase_21 AC 138 ms
60,104 KB
testcase_22 AC 135 ms
60,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No0186 {
    
    static final Scanner in = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() {
        boolean[][] f = new boolean[3][1000001];
        for (int i=0; i<3; i++) {
            int x = in.nextInt();
            int y = in.nextInt();
            for (int j=x; j<1000001; j+=y) {
                f[i][j] = true;
            }
        }

        for (int i=0; i<1_000_001; i++) {
            if (f[0][i] && f[1][i] && f[2][i]) {
                out.println(i);
                return;
            }
        }
        out.println("-1");
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        in.close();
        out.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0