結果

問題 No.1680 Sum and Difference
ユーザー hogehogehogehoge
提出日時 2021-09-17 21:50:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 299 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 10,716 KB
実行使用メモリ 7,960 KB
最終ジャッジ日時 2023-09-12 07:18:29
合計ジャッジ時間 1,320 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,960 KB
testcase_01 AC 17 ms
7,904 KB
testcase_02 AC 17 ms
7,864 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 15 ms
7,916 KB
testcase_06 AC 15 ms
7,852 KB
testcase_07 AC 15 ms
7,812 KB
testcase_08 WA -
testcase_09 AC 14 ms
7,796 KB
testcase_10 AC 15 ms
7,860 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 15 ms
7,800 KB
testcase_17 AC 16 ms
7,788 KB
testcase_18 WA -
testcase_19 AC 15 ms
7,804 KB
testcase_20 AC 15 ms
7,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x,y = map(int,input().split())
a = max(x,y)
b = min(x,y)
l = 1000000007
if (a-b)%2==0:
    target1 = ((2*b+1)%l)*((a-b+1)%l)%l
    target2 = ((b%l)**2)%l*2
    ans = (target1+target2)%l
else:
    target1 = ((2*b+1)%l)*((a-b)%l)%l
    target2 = ((b%l)**2)%l*2
    ans = (target1+target2)%l
print(ans)
0