結果

問題 No.1680 Sum and Difference
ユーザー kohei2019
提出日時 2022-07-01 00:06:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 37 ms / 1,000 ms
コード長 196 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 82,280 KB
実行使用メモリ 53,508 KB
最終ジャッジ日時 2024-11-25 00:17:22
合計ジャッジ時間 1,744 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B = map(int,input().split())
mod = 10**9+7
if (A+B)%2==0:
    if A<B:
        A,B= B,A
    print((2*(B+1)**2-(2*B+1)+(2*B+1)*(A-B))%mod)
else:
    print((2*(B+1)**2-(2*B+1)+(2*B+1)*(A-B)-1)%mod)
0