欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ACM寒假集训

程序员文章站 2024-03-20 13:33:46
...

题目链接:https://vjudge.net/contest/279620#problem/C
代码:

#include <iostream>
using namespace std;
int main()
{
	int a, b,i,sum;
	cin >> a >> b;
	sum = a;
	if (a < 1 || a>1000 || b < 2 || b>1000)
		return 0;
	for (i = 0; i >= 0; i++)
	{
		a = a - b;
		if (a < 0)
			break;
		a = a + 1;
	}
	sum = sum + i;
	cout << sum;
}