#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

int main() {
	int i;
	int empty;
	int num = 0;
	printf("请输入钱数:");
	scanf("%d", &i);
	empty = i;
	while (empty >= 1) {
		empty += num;
		i += empty / 2;
		num = empty % 2;
		empty /= 2;
	}
	printf("可以换取 %d 瓶汽水\n", i);
	system("pause");
	return 0;
}

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

相关文章:

  • 2021-07-22
  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
猜你喜欢
  • 2021-07-27
  • 2021-06-04
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
相关资源
相似解决方案