結果

問題 No.1862 Copy and Paste
ユーザー floraflora
提出日時 2022-03-04 21:57:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,007 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 71,740 KB
最終ジャッジ日時 2023-09-26 00:52:10
合計ジャッジ時間 4,190 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,324 KB
testcase_01 AC 77 ms
71,272 KB
testcase_02 AC 77 ms
71,432 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 71 ms
71,464 KB
testcase_06 WA -
testcase_07 AC 74 ms
71,368 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 76 ms
71,224 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 72 ms
71,552 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 71 ms
71,456 KB
testcase_19 AC 75 ms
71,100 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 73 ms
71,252 KB
testcase_26 WA -
testcase_27 AC 74 ms
71,016 KB
testcase_28 AC 73 ms
71,464 KB
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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をする
	if -(-r//T)*B<A+B:
		#このときは1.の操作をする
		time+=-(-r//T)*B
		S+=r
	else:
		time+=A+B
		T=S
		S+=T

print(time)
0