結果

問題 No.1680 Sum and Difference
ユーザー Sumitacchan
提出日時 2021-08-02 16:29:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 1,000 ms
コード長 317 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-06-29 19:21:20
合計ジャッジ時間 1,453 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
Created on Sun Aug  1 14:11:40 2021

@author: sumitacchan
"""

A, B = map(int, input().split())
mod = 10**9 + 7

assert(0 <= A and A <= 10**18)
assert(0 <= B and B <= 10**18)

if A % 2 == B % 2:
    ans = ((2*A+1)*(2*B+1)+1)//2
else:
    ans = ((2*A+1)*(2*B+1)-1)//2

ans %= mod
print(ans)
0