結果

問題 No.2057 Ising Model
ユーザー FromBooskaFromBooska
提出日時 2023-06-09 14:42:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 567 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,328 KB
実行使用メモリ 841,176 KB
最終ジャッジ日時 2023-08-30 08:47:55
合計ジャッジ時間 7,059 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,380 KB
testcase_01 AC 74 ms
71,440 KB
testcase_02 AC 72 ms
71,560 KB
testcase_03 AC 72 ms
71,584 KB
testcase_04 AC 73 ms
71,148 KB
testcase_05 AC 72 ms
71,264 KB
testcase_06 AC 71 ms
71,308 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 72 ms
71,208 KB
testcase_10 AC 71 ms
71,468 KB
testcase_11 AC 71 ms
71,304 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 73 ms
71,264 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 74 ms
71,284 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 MLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 最後は1がいい
# その1つ前は+1 or -1
# 実験すると全部1というのと、最後から2番目だけ-1というのがある
# なぜかはわからない
# 10**10は計算できないと思うがとりあえずやってみよう

N, A, B = map(int, input().split())
S1 = [1]*N
S2 = S1[:N-2] + [-1] + [1]
#print(S1, S2)

ans1 = 0
for i in range(N-1):
    ans1 += A*S1[i]*S1[i+1]
for i in range(N):
    ans1 -= B*S1[i]
    
ans2 = 0
for i in range(N-1):
    ans2 += A*S2[i]*S2[i+1]
for i in range(N):
    ans2 -= B*S2[i]
ans = min(ans1, ans2)
print(ans)
0