結果

問題 No.1680 Sum and Difference
ユーザー tcltktcltk
提出日時 2021-09-18 14:03:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 219 ms / 1,000 ms
コード長 531 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 89,612 KB
最終ジャッジ日時 2023-09-13 00:45:41
合計ジャッジ時間 6,293 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 218 ms
89,428 KB
testcase_01 AC 212 ms
89,580 KB
testcase_02 AC 214 ms
89,576 KB
testcase_03 AC 210 ms
89,612 KB
testcase_04 AC 212 ms
89,260 KB
testcase_05 AC 211 ms
89,416 KB
testcase_06 AC 212 ms
89,436 KB
testcase_07 AC 214 ms
89,456 KB
testcase_08 AC 218 ms
89,392 KB
testcase_09 AC 213 ms
89,412 KB
testcase_10 AC 211 ms
89,580 KB
testcase_11 AC 213 ms
89,580 KB
testcase_12 AC 218 ms
89,544 KB
testcase_13 AC 212 ms
89,572 KB
testcase_14 AC 212 ms
89,436 KB
testcase_15 AC 217 ms
89,488 KB
testcase_16 AC 212 ms
89,260 KB
testcase_17 AC 213 ms
89,380 KB
testcase_18 AC 213 ms
89,484 KB
testcase_19 AC 219 ms
89,580 KB
testcase_20 AC 219 ms
89,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)

INF = 10**10

MOD = 10**9+7

A, B = map(int, input().split())
if A%2 == B%2:
    A %= MOD
    B %= MOD
    ans = ((A+1)*(B+1)+A*B) % MOD
else:
    A %= MOD
    B %= MOD
    ans = (A*(B+1)+(A+1)*B) % MOD

print(ans)
0