比赛 寒假集训4 评测结果 AAAAAAAATT
题目名称 金币 最终得分 80
用户昵称 赵飞羽 运行时间 2.549 s
代码语言 C++ 内存使用 3.68 MiB
提交时间 2026-02-28 10:30:54
显示代码纯文本
#include <bits/stdc++.h>
#define int long long
using namespace std;

int n, k, x = 1, ans;

signed main() {
	freopen("Gold_coin.in", "r", stdin);
	freopen("Gold_coin.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n >> k;
	while (x <= n) {
		ans = x;
		x = x + 1 + ((x - 1) / (k - 1));
	}
	cout << ans;
	return 0;
}