結果
| 問題 |
No.604 誕生日のお小遣い
|
| コンテスト | |
| ユーザー |
fushime2
|
| 提出日時 | 2018-03-07 16:33:22 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 521 bytes |
| コンパイル時間 | 770 ms |
| コンパイル使用メモリ | 111,064 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-13 00:04:24 |
| 合計ジャッジ時間 | 1,450 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
import std.stdio, std.algorithm, std.string, std.string, std.conv, std.array, std.range, std.math;
long A, B, C;
bool can(long age) {
import std.bigint;
BigInt x = age / A;
BigInt y = age - x;
return x * B >= C - y;
}
void main() {
auto input = readln.split.to!(long[]);
A = input[0]; B = input[1]; C = input[2];
long lb = -1, ub = 10L^^18 + 10;
while (ub - lb > 1) {
long mid = lb + (ub - lb) / 2;
if (can(mid)) ub = mid;
else lb = mid;
}
writeln(ub);
}
fushime2