結果

問題 No.186 中華風 (Easy)
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-04-19 23:56:34
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,087 bytes
コンパイル時間 3,416 ms
コンパイル使用メモリ 74,664 KB
実行使用メモリ 66,884 KB
最終ジャッジ日時 2023-09-18 02:05:24
合計ジャッジ時間 7,834 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
64,280 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 144 ms
64,268 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 143 ms
64,288 KB
testcase_20 AC 142 ms
64,584 KB
testcase_21 AC 142 ms
64,020 KB
testcase_22 AC 142 ms
64,296 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][3000001];
        for (int i=0; i<3; i++) {
            int x = in.nextInt();
            int y = in.nextInt();
            for (int j=x; j<f[0].length; j+=y) {
                f[i][j] = true;
            }
        }

        for (int i=0; i<f[0].length; 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