40分求助!
查看原帖
40分求助!
1292414
LeonTexius楼主2024/7/23 13:42
#include <bits/stdc++.h>
int queshao,lack,mcun;
int need[20];
double cun;
using namespace std;
int main()
{
	for(int i = 1;i <= 12;i++)
	{
		scanf("%d",&need[i]);
		
	}
	for(int i = 1;i <= 12;i++)
	{
		if(lack + 300 - need[i] >= 100)
		{
			mcun = (lack + 300 - need[i])  -  (lack + 300 - need[i]) % 100;
			cun = cun + mcun;
			
			lack = lack + 300 - mcun - need[i];
			
		}
		else if(lack + 300 - need[i] >= 0)
		{
			lack = lack + 300 - need[i];
			
		}
		else
		{
			queshao = i;
			break;
			
			
		}
	}
	if(queshao == 0)
	{
		cout << cun * 1.2;
		
	}
	else
	{
		cout << "-" << queshao;
		
	}
	return 0;
}

2024/7/23 13:42
加载中...