結果

問題 No.3633 Rabbit and turtle
コンテスト
ユーザー Unbakedbread
提出日時 2026-06-13 18:02:05
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
実行時間 -
コード長 450 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 232 ms
コンパイル使用メモリ 95,852 KB
実行使用メモリ 94,044 KB
最終ジャッジ日時 2026-08-21 20:54:23
合計ジャッジ時間 4,258 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

T = int(input())
for _ in range(T):
	A, B, D, R = map(int, input().split())
	P = R + D
	
	rP = A * R
	tP = B * P
	if rP != tP:
		print("turtle" if rP < tP else "rabbit")
		continue
	
	rem = pow(10, 100, W)
	ok, ng = 0, rem + 1
	while ok - ng > 1:
		mid = (ok + ng) // 2
		if mid * D <= (rem - mid) * R:
			ok = mid
		else:
			ng = mid
	
	rD = A * ok
	tD = B * rem
	if rD < tD:
		print("turtle")
	elif rD == tD:
		print("tie")
	else:
		print("rabbit")
0