結果

問題 No.1680 Sum and Difference
ユーザー ansainansain
提出日時 2021-09-17 21:49:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 323 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2023-09-12 07:15:54
合計ジャッジ時間 1,599 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def yn(hantei, yes='Yes', no='No'): print(yes if hantei else no)
def p(*args): print(*args)
mod=10**9+7
a,b=map(int, input().split())
if b>a:
    a,b=b,a
if a%2==0:
    f=a+1
    ans=f+2*(2*f-1)*(b//2)
    if b%2==1:
        ans+=2*f
else:
    f=a
    ans=f+2*(2*f+1)*(b//2)
    if b%2==1:
        ans+=2*(f+1)
p(ans%mod)

0