結果
| 問題 | No.3633 Rabbit and turtle |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-21 22:00:10 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 100 ms / 2,000 ms |
| + 210µs | |
| コード長 | 857 bytes |
| 記録 | |
| コンパイル時間 | 1,847 ms |
| コンパイル使用メモリ | 334,312 KB |
| 実行使用メモリ | 9,416 KB |
| 最終ジャッジ日時 | 2026-08-21 22:00:17 |
| 合計ジャッジ時間 | 4,893 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll t;
cin >> t;
while (t--) {
ll a, b, d, r;
cin >> a >> b >> d >> r;
ll g = gcd(r, d);
r /= g;
d /= g;
ll s = r + d;
if (b * s == a * r) {
ll x = 1;
rep(i, 100) {
x *= 10;
x %= s;
}
ll y = d * x % (d + r);
if (y == 0)
cout << "tie" << endl;
else if (y > d)
cout << "turtle" << endl;
else
cout << "rabbit" << endl;
} else {
cout << (b * s > a * r ? "turtle" : "rabbit") << endl;
}
}
return 0;
}