結果

問題 No.1862 Copy and Paste
ユーザー floraflora
提出日時 2022-03-04 22:22:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 998 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,308 KB
実行使用メモリ 80,072 KB
最終ジャッジ日時 2023-09-26 01:29:56
合計ジャッジ時間 6,510 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,508 KB
testcase_01 AC 68 ms
71,284 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 67 ms
71,276 KB
testcase_05 AC 67 ms
71,316 KB
testcase_06 AC 67 ms
71,252 KB
testcase_07 AC 67 ms
71,200 KB
testcase_08 AC 68 ms
71,344 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 68 ms
71,332 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 68 ms
71,600 KB
testcase_15 AC 68 ms
71,316 KB
testcase_16 AC 69 ms
71,516 KB
testcase_17 WA -
testcase_18 AC 69 ms
71,276 KB
testcase_19 AC 70 ms
71,500 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 69 ms
71,320 KB
testcase_26 WA -
testcase_27 AC 69 ms
71,276 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B=map(int,input().split())
N=int(input())

#Tにためて、Sに追加する。操作Aを連続するということはありえない。
#つまり何回BをしてからAをするかということである。
#最初は必ずAをする
#いまのSを二倍にするには、len(S)//len(T)回Bをする、もしくはAをしてからBをするという方法がある。これを比べてどんどん2倍にしていく

#最初はp,pから
if N==1:
	print(0)
	exit()
time=A
#長さ以外の情報はないので整数でもつ
S=1
T=1
while S<N:
	if S==T:
		#このときは必ずBの操作をする
		time+=B
		S+=T
		continue
	#ふたつの時間を比べる
	#1.の方は
	if 2*S>=N:
		#このときはSを2倍ではなくてNにすることを考える。
		r=N-S
	else:
		#このときは2倍
		r=S
	#1.の操作はrだけのバスためにはceil(r/T)だけBをする
	#print(S,T,time)
	if -(-r//T)*B<A+B:
		#このときは1.
		time+=B
		S+=T
	else:
		time+=A+B
		T=S
		S+=T

print(time)
0