結果
問題 |
No.604 誕生日のお小遣い
|
ユーザー |
|
提出日時 | 2020-07-29 02:56:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 488 bytes |
コンパイル時間 | 1,942 ms |
コンパイル使用メモリ | 191,704 KB |
最終ジャッジ日時 | 2025-01-12 07:27:03 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long a, b, c; cin >> a >> b >> c; long long hi = c; long long lo = 0; while (hi - lo > 1) { long long mi = (lo + hi) / 2; long long x = mi / a; long long y = mi - x; if (1.0 * b * x + y >= 2.0 * c || b * x + y >= c) hi = mi; else lo = mi; } cout << hi << endl; return 0; }