记录编号 |
93122 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2004]津津的储蓄计划 |
最终得分 |
100 |
用户昵称 |
Will |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.004 s |
提交时间 |
2014-03-24 17:05:10 |
内存使用 |
0.29 MiB |
显示代码纯文本
#include <stdio.h>
int main() {
freopen("save.in","r",stdin);
freopen("save.out","w",stdout);
int budget,total,temporary;
double save=0;
int last_month;
total=300;
scanf("%d",&budget);
last_month=budget;
if(total<budget) {
printf("-1\n");
return 0;
}
else {
temporary=total-budget;
if(temporary>=100) {
save+=temporary-temporary%100;
total=total-(temporary-temporary%100);
}
}
for(int i=2;i<=12;i++) {
total-=last_month;
total+=300;
scanf("%d",&budget);
last_month=budget;
if(total<budget) {
printf("-%d\n",i);
return 0;
}
else {
temporary=total-budget;
if(temporary>=100) {
save+=temporary-temporary%100;
total=total-(temporary-temporary%100);
}
}
}
total-=last_month;
save*=1.2;
save+=total;
printf("%.0lf\n",save);
return 0;
}