結果
| 問題 |
No.604 誕生日のお小遣い
|
| コンテスト | |
| ユーザー |
okayunonaha
|
| 提出日時 | 2017-12-09 02:43:38 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 590 bytes |
| コンパイル時間 | 973 ms |
| コンパイル使用メモリ | 111,628 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-12 22:56:29 |
| 合計ジャッジ時間 | 1,594 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 4 |
ソースコード
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
import std.math;
import std.range;
import std.bigint;
void main() {
auto l = readln.chomp.split.map!(to!long).array;
long a = l[0], b = l[1], c = l[2];
long lb = 1L, rb = 1e18.to!long, mid;
while (rb - lb > 1) {
mid = (lb + rb) / 2;
BigInt money = BigInt(b) * BigInt(mid / a) + BigInt((mid - mid / a));
if (money > BigInt(c)) {
rb = mid;
}
else if (money < BigInt(c)) {
lb = mid;
}
else {
rb = mid;
break;
}
}
rb.writeln;
}
okayunonaha