'commit'
This commit is contained in:
26
C++专题课程/NOIP算法总结/模拟/津津的储蓄计划/P1089.cpp
Normal file
26
C++专题课程/NOIP算法总结/模拟/津津的储蓄计划/P1089.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include<iostream>
|
||||
#include<stdio.h>
|
||||
using namespace std;
|
||||
int main() {
|
||||
int i,month,left=0,save=0,sum,plan,flag=0;
|
||||
for(month=1; month<=12; month++) {
|
||||
left+=300;
|
||||
scanf("%d",&plan);
|
||||
left = left - plan;
|
||||
if(left<0) {
|
||||
flag=1;
|
||||
break;
|
||||
} else {
|
||||
i = left/100;
|
||||
save += (100*i);
|
||||
left -= (100*i);
|
||||
}
|
||||
}
|
||||
if(flag>0)
|
||||
printf("-%d",month);
|
||||
else {
|
||||
sum=((1.2*save) + left);
|
||||
printf("%d",sum);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
1
C++专题课程/NOIP算法总结/模拟/津津的储蓄计划/题目链接.txt
Normal file
1
C++专题课程/NOIP算法总结/模拟/津津的储蓄计划/题目链接.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://www.luogu.org/problem/P1089
|
||||
Reference in New Issue
Block a user