結果

問題 No.982 Add
ユーザー maguchi_p_qmaguchi_p_q
提出日時 2020-02-11 14:27:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 271 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 17,768 KB
最終ジャッジ日時 2024-04-08 15:02:11
合計ジャッジ時間 18,382 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 786 ms
17,768 KB
testcase_01 AC 29 ms
9,856 KB
testcase_02 AC 789 ms
17,768 KB
testcase_03 AC 767 ms
17,768 KB
testcase_04 WA -
testcase_05 AC 793 ms
17,768 KB
testcase_06 AC 777 ms
17,768 KB
testcase_07 AC 792 ms
17,768 KB
testcase_08 AC 822 ms
17,768 KB
testcase_09 AC 762 ms
17,768 KB
testcase_10 AC 799 ms
17,768 KB
testcase_11 AC 750 ms
17,768 KB
testcase_12 AC 762 ms
17,768 KB
testcase_13 AC 773 ms
17,768 KB
testcase_14 AC 775 ms
17,768 KB
testcase_15 AC 775 ms
17,768 KB
testcase_16 AC 761 ms
17,768 KB
testcase_17 AC 775 ms
17,768 KB
testcase_18 AC 30 ms
9,856 KB
testcase_19 AC 29 ms
9,856 KB
testcase_20 AC 30 ms
9,856 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 31 ms
9,856 KB
testcase_24 AC 777 ms
17,768 KB
testcase_25 AC 778 ms
17,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B = [int(zz) for zz in input().split()]

if (A%2)+(B%2) == 0:
    print(-1)
else:
    dp = [1]*(10**6)
    dp[0] = 0
    for i in range(10**6):
        if i >= A:
            dp[i] = dp[i-A]
        if i >= B:
            dp[i] = min(dp[i-B],dp[i])

    print(sum(dp))
0