纯新手,80分求帮助
查看原帖
纯新手,80分求帮助
1566845
chamber24楼主2024/11/18 17:33
#include<stdio.h>
int main() 
{
	int a ;
	int shengyu= 0;
	int count=0;
	int b = 0;
	int c = 0;
	int d = 0;
	for (int i = 1;i <=12;i++) 
	{	
		shengyu += 300;
		scanf("%d", &a);
		shengyu = shengyu - a;
		if (shengyu < 0) 
		{
			printf("-%d", i);
			break;
		}
		if (shengyu >=100) 
		{
			b = shengyu / 100;
			shengyu = shengyu - b * 100;
			count+=(100*b);
			d = 1;
		}
	}
	if (d == 1) {
		c = (1.2 * count) + shengyu;
		printf("%d", c);
	}
	return 0;
}
2024/11/18 17:33
加载中...