結果

問題 No.3633 Rabbit and turtle
コンテスト
ユーザー pengin_2000
提出日時 2026-09-03 20:50:34
言語 C
(gcc 15.3.0)
コンパイル:
gcc-15 -O2 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 481 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,419 ms
コンパイル使用メモリ 35,968 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-09-03 20:50:42
合計ジャッジ時間 3,016 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>
void solve()
{
	long long int a, b, d, r;
	scanf("%lld %lld %lld %lld", &a, &b, &d, &r);
	b *= (d + r - 1) / r + 1;
	if (a > b)
		printf("rabbit\n");
	else if (a < b)
		printf("turtle\n");
	else
	{
		long long int c = (d + r - 1) / r + 1;
		while (c % 2 == 0)
			c /= 2;
		while (c % 5 == 0)
			c /= 5;
		if (c > 1)
			printf("rabbit\n");
		else
			printf("tie\n");
	}

	return;
}
int main()
{
	int t;
	scanf("%d", &t);
	for (; t > 0; t--)
		solve();
	return 0;
}
0