結果
| 問題 |
No.604 誕生日のお小遣い
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-30 12:32:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 768 bytes |
| コンパイル時間 | 622 ms |
| コンパイル使用メモリ | 71,976 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-21 19:29:07 |
| 合計ジャッジ時間 | 1,253 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>
#define L64 long long
#define MOD (1000000007LL)
bool checkLt(L64 age, L64 a, L64 b, L64 c)
{
L64 z = age / a;
//L64 x = z * b + age - z;
//return x < c;
//z * b < c - age + z
if((c - age + z) % b == 0){
return z < (c - age + z) / b;
} else {
return z <= (c - age + z) / b;
}
}
int main(void)
{
L64 a, b, c;
std::cin >> a >> b >> c;
L64 min, max;
min = 0; max = c;
while(1LL < max - min){
L64 mid = (min + max) / 2LL;
bool ret = checkLt(mid, a, b, c);
if(ret){
min = mid;
} else {
max = mid;
}
}
std::cout << max << std::endl;
}