結果
| 問題 | No.604 誕生日のお小遣い |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2026-02-01 00:14:41 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 588 bytes |
| 記録 | |
| コンパイル時間 | 3,507 ms |
| コンパイル使用メモリ | 332,496 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-02-01 00:14:45 |
| 合計ジャッジ時間 | 3,572 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
constexpr ll INF = 2e18;
inline ll satulating_mul(const ll a, const ll b) {
if (b == 0) return 0;
if (a > INF / b) return INF;
return a * b;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
ll a, b, c;
cin >> a >> b >> c;
ll ok = c, ng = 0;
while (ok - ng > 1) {
ll mid = (ok + ng) / 2;
ll cur = satulating_mul(b - 1, mid / a) + mid;
(cur >= c ? ok : ng) = mid;
}
cout << ok << '\n';
return 0;
}
a01sa01to