結果

問題 No.1448 和差算
ユーザー あかりきあかりき
提出日時 2021-04-11 20:45:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 86,796 KB
実行使用メモリ 71,528 KB
最終ジャッジ日時 2023-09-09 22:37:08
合計ジャッジ時間 5,238 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,348 KB
testcase_01 AC 69 ms
71,196 KB
testcase_02 AC 68 ms
71,376 KB
testcase_03 AC 70 ms
71,148 KB
testcase_04 AC 74 ms
71,244 KB
testcase_05 AC 69 ms
71,196 KB
testcase_06 AC 69 ms
71,340 KB
testcase_07 AC 69 ms
71,504 KB
testcase_08 AC 71 ms
71,308 KB
testcase_09 AC 70 ms
71,376 KB
testcase_10 AC 71 ms
71,004 KB
testcase_11 AC 70 ms
71,152 KB
testcase_12 AC 69 ms
71,344 KB
testcase_13 AC 68 ms
71,528 KB
testcase_14 AC 69 ms
71,384 KB
testcase_15 AC 68 ms
71,192 KB
testcase_16 AC 68 ms
71,260 KB
testcase_17 AC 69 ms
71,520 KB
testcase_18 AC 68 ms
71,380 KB
testcase_19 AC 69 ms
71,104 KB
testcase_20 AC 69 ms
71,000 KB
testcase_21 AC 70 ms
71,408 KB
testcase_22 AC 69 ms
71,344 KB
testcase_23 AC 68 ms
71,416 KB
testcase_24 AC 69 ms
70,956 KB
testcase_25 AC 71 ms
71,324 KB
testcase_26 AC 70 ms
71,384 KB
testcase_27 AC 71 ms
71,500 KB
testcase_28 AC 70 ms
71,340 KB
testcase_29 AC 69 ms
71,372 KB
testcase_30 AC 70 ms
71,508 KB
testcase_31 AC 69 ms
71,504 KB
testcase_32 AC 70 ms
71,340 KB
testcase_33 AC 68 ms
71,412 KB
testcase_34 AC 68 ms
71,336 KB
testcase_35 AC 67 ms
71,496 KB
testcase_36 AC 68 ms
71,196 KB
testcase_37 AC 68 ms
71,304 KB
testcase_38 AC 68 ms
71,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b,c,d=map(int,input().split())
n=int(input())
mod=10**9+7
x=n//4;y=n%4
z=pow(4,x,mod)
if y==0:
  a1=z;a2=0
elif y==1:
  a1=z;a2=z
elif y==2:
  a1=0;a2=2*z
else:
  a1=-2*z;a2=2*z
if x%2==1:
  a1*=-1;a2*=-1
b1=-a2;b2=a1

A=a1+a2;B=b1+b2
ans=0
if A>=0:
  ans+=A*b
else:
  ans+=A*(a)
if B>=0:
  ans+=B*d
else:
  ans+=B*c
print(ans%mod)
0