喝汽水1瓶汽水1元2个空瓶可以换一瓶汽水给20元可以多少汽水


int main()
{
	int money = 0;
	int total = 0;
	int empty = 0;

	scanf_s("%d", &money);
	if (money <= 0)
	{
		total = 0;
	}
	else
	{
		total = money * 2 - 1;
	}
	/*total = money;
	empty = money;
	while (empty > 1)
	{
	total += empty / 2;
	empty=empty / 2 + empty % 2;
	}*/
	printf("%d\n", total);
	system("pause");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_41892460/article/details/82826947