#include<stdio.h>
int main(void)
{
int i, deposit=0, cash=0;
int a[12];
for (i = 0; i < 12; i++)
{
scanf("%d", &a[i]);
}
for (i = 0; i < 12; i++)
{
if (300 + cash - a[i] >= 100)
{
deposit += (300 + cash - a[i]) / 100 *100;
cash += 300-(300 + cash - a[i]) / 100 * 100-a[i];
}
else if(300 + cash - a[i]<0)
{
printf("-%d", i + 1);
return(0);
}
else
{
cash += 300 - a[i];
}
}
printf("%d", (int)(1.2 * deposit)+cash);
return(0);
}
洛谷P1089 [NOIP2004 提高组] 津津的储蓄计划经典解法
最新推荐文章于 2023-10-26 17:03:06 发布