結果

問題 No.604 誕生日のお小遣い
ユーザー lapilapi
提出日時 2019-03-31 13:47:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 811 bytes
コンパイル時間 1,007 ms
コンパイル使用メモリ 100,656 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 10:21:39
合計ジャッジ時間 1,779 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

ll A, B, C;

// n年までにもらえる総額がCより多いかどうか
bool money(ll n) {
	return (((n / A)*B + (n - n / A)) >= C);
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> A >> B >> C;

	// left < ans <= right
	ll left = 0;
	ll right = C;
	while (left + 1 != right) {
		ll mid = (left + right) / 2;
		if (money(mid)) right = mid;
		else left = mid;
	}

	cout << right << endl;

	return 0;
}
0