P1089 津津的储蓄计划

#define  _CRT_SECURE_NO_WARNINGS
#include 
#include 

int main() {
	int spend, get = 0, deposit = 0;
	for (int i = 1; i <= 12; ++i) {
		scanf("%d", &spend);
		get -= spend - 300;
		if (get < 0) {
			printf("-%d", i);
			break;
		}
		else {
			deposit += get / 100;
			get %= 100;
		}
	}
	printf("%d", 120 * deposit + get);
	system("pause");
	return 0;
}

P1089 津津的储蓄计划_第1张图片

你可能感兴趣的:(luogu)