結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
64,132 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 147 ms
64,156 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 146 ms
63,860 KB
testcase_20 AC 149 ms
64,112 KB
testcase_21 AC 146 ms
63,932 KB
testcase_22 AC 147 ms
64,572 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=1; 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