- 津津的储蓄计划
救救
- 2024-11-2 16:07:14 @
#include <bits/stdc++.h>
using namespace std;
int main()
{
int yusuan , ew , cun = 0 , shengyu = 0 , H , shouyou = 0 , a;
for(int i = 1 ; i <= 12 ; i++)
{
cin >> yusuan ; //每月的预算
ew = (300 - yusuan) / 100 ; //存储的钱
shouyou = shengyu + 300 - (ew * 100); //计算存储后拥有的钱
shengyu = shouyou - yusuan; //使用后剩余的钱
a = shengyu / 100;
shengyu = shengyu - a * 100; //满一百存钱
if(yusuan > shouyou)
{
cout << -i << endl;
return 0;
} //判断是否超额
if(ew != 0)
{
cun = cun + (ew * 100);
if(a != 0 )
cun = cun + a * 100;
} //每月存储
}
H = cun * 1.2 + shengyu + shouyou;
cout << H << endl;
return 0;
}
0 comments
No comments so far...
Information
- ID
- 576
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 4
- Tags
- # Submissions
- 225
- Accepted
- 102
- Uploaded By