记录编号 87867 评测结果 AAAAAAAAAA
题目名称 [NOIP 2004]津津的储蓄计划 最终得分 100
用户昵称 Gravatarnoier 是否通过 通过
代码语言 C++ 运行时间 0.010 s
提交时间 2014-02-11 14:39:57 内存使用 0.31 MiB
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#pragma warning(disable:4996)
using namespace std;
int main()
{
	freopen("save.in", "r", stdin);
	freopen("save.out", "w", stdout);
	int cost[13] = { 0 }, money[13][3] = { 0 }, cun = 0,hand;
	bool y = false;
	for (int i = 0; i < 12; i++) money[i][1] = 300;
	for (int i = 0; i < 12; i++) cin >> cost[i];
	for (int i = 0; i < 12; i++) money[i][0]=i+1;
	for (int i = 0; i < 12; i++)
	{
		hand=money[i][1];
		if (hand - cost[i] >= 300)
		{
			cun = cun + 300;
			hand = hand - 300 - cost[i];
			money[i + 1][1] = money[i + 1][1]+ hand;
		}
		else if (hand - cost[i] >= 200)
		{
			cun = cun + 200;
			hand = hand - 200 - cost[i];
			money[i + 1][1] = money[i + 1][1] + hand;
		}
		else if (hand - cost[i] >= 100)
		{
			cun = cun + 100;
			hand = hand - 100 - cost[i];
			money[i + 1][1] = money[i + 1][1] + hand;
		}
		else if (hand - cost[i] <0)
		{
			y = true;
			cout <<"-"<< money[i][0];
			break;
		}
		else money[i + 1][1] = money[i + 1][1] + hand-cost[i];
	}
	if (y == false) cout << cun*1.2+hand;
	return 0;
}