当前位置:网站首页>Brush questions - luogu-p1089 Jinjin savings plan
Brush questions - luogu-p1089 Jinjin savings plan
2022-07-25 13:43:00 【Song Xiangshang_ UP】
P1089 Jinjin's savings plan -C Language
1、 subject

2、 The problem solving process
result :
Code :
// Luogu P1089 Jinjin's savings plan
#include <stdio.h>
#define MONTHS 12 //12 Months
#define POCKET 300// Monthly allowance
int main() {
int money;
int budget;// The budget
int surplus=0;// The remaining
int mom_money=0;// Save your mother's money
int temp;
int i;
for (i = 0; i < MONTHS; i++) {
scanf("%d", &budget);// Monthly budget
surplus = surplus+ POCKET - budget;// After deducting the budget, the remaining money in Jinjin's hands
temp = surplus / 100;
mom_money = mom_money + temp * 100;// Save your mother's money
surplus = surplus - temp * 100;// Subtract the money left in Jinjin's hand after saving it in her mother's hand
if (surplus < 0) {
printf("-%d", i + 1);// In the first month, there was insufficient money
return 0;
}
}
surplus = surplus + (int)(mom_money * 1.2);// Money in Jinjin at the end of the year
printf("%d", surplus);
return 0;
}
边栏推荐
- 刷题-洛谷-P1161 开灯
- The interviewer asked me: how much do you know about MySQL's storage engine?
- MXNet对DenseNet(稠密连接网络)的实现
- 电脑里一辈子都不想删的神仙软件
- 刷题-洛谷-P1035 级数求和
- 0716RHCSA
- Talk about your understanding of hashcode and equals methods?
- IM system - some common problems of message streaming
- Excel add key run macro
- The migration of arm architecture to alsa lib and alsa utils is smooth
猜你喜欢

Audio and video technology development weekly | 255
![[configure hifive1 revb] the device manager does not recognize the port, and can not connect to j-link via USB](/img/55/a8acdd63a17bf9e3072c9a04babe79.png)
[configure hifive1 revb] the device manager does not recognize the port, and can not connect to j-link via USB

0710RHCSA

刷题-洛谷-P1035 级数求和

刷题-洛谷-P1046 陶陶摘苹果

刷题-洛谷-P1150 Peter的烟

为提高效率使用ParallelStream竟出现各种问题

Redis visualizer RDM installation package sharing

IM系统-消息流化一些常见问题

刷题-洛谷-P1047 校门外的树
随机推荐
hcip第十天笔记
0710RHCSA
并发编程之AQS
Discussion on principle and application technology of MLIR
面试官问我:Mysql的存储引擎你了解多少?
Uniapp handles background transfer pictures
刷题-洛谷-P1146 硬币翻转
Error: cannot find or load main class XXXX
GCD details
sieve of eratosthenes
Int array get duplicate data
剑指offer专项突击版第10天
How to use handwritten JDBC?
并发编程之阻塞队列
Prepare for 2022 csp-j1 2022 csp-s1 preliminaries video set
Mujoco+spinningup for intensive learning training quick start
Canal realizes MySQL data synchronization
Basic knowledge of binary tree
[server data recovery] HP EVA server storage raid information power loss data recovery
手写jdbc的使用步骤?