結果

問題 No.1680 Sum and Difference
ユーザー hir355hir355
提出日時 2021-09-17 21:43:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 1,000 ms
コード長 251 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 71,356 KB
最終ジャッジ日時 2023-09-12 07:10:12
合計ジャッジ時間 3,003 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,252 KB
testcase_01 AC 72 ms
70,864 KB
testcase_02 AC 74 ms
71,284 KB
testcase_03 AC 74 ms
71,264 KB
testcase_04 AC 76 ms
71,256 KB
testcase_05 AC 74 ms
71,352 KB
testcase_06 AC 72 ms
71,292 KB
testcase_07 AC 75 ms
71,304 KB
testcase_08 AC 74 ms
71,316 KB
testcase_09 AC 75 ms
71,116 KB
testcase_10 AC 75 ms
71,204 KB
testcase_11 AC 76 ms
71,356 KB
testcase_12 AC 74 ms
71,288 KB
testcase_13 AC 73 ms
71,252 KB
testcase_14 AC 73 ms
71,216 KB
testcase_15 AC 76 ms
71,248 KB
testcase_16 AC 73 ms
71,304 KB
testcase_17 AC 73 ms
70,980 KB
testcase_18 AC 73 ms
71,248 KB
testcase_19 AC 74 ms
71,308 KB
testcase_20 AC 73 ms
71,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
a, b = map(int, input().split())
if a == 0:
    print(1)
elif b == 0:
    print((a + (a + 1) % 2) % MOD)
else:
    if a % 2 == b % 2:
        print((2 * a * b + (a + b) + 1) % MOD)
    else:
        print((2 * a * b + (a + b)) % MOD)
0