当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
![[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

包管理 apt,dpkg

uniapp处理后台传输图片

安装mujoco报错:distutils.errors.DistutilsExecError: command ‘gcc‘ failed with exit status 1

The migration of arm architecture to alsa lib and alsa utils is smooth

Basic knowledge of binary tree

Numpy简介和特点(一)

刷题-洛谷-P1047 校门外的树
![[server data recovery] HP EVA server storage raid information power loss data recovery](/img/ee/8f36ef1b5842f1778c0dd695401b40.jpg)
[server data recovery] HP EVA server storage raid information power loss data recovery

Esp32-c3 is based on blinker lighting control 10 way switch or relay group under Arduino framework
随机推荐
0720RHCSA
leetcode1 --两数之和
并发编程之AQS
What is your revenue rank among global developers in 2022?
Uniapp handles background transfer pictures
【力扣】645.错误的集合
Sports luxury or safety luxury? Which type of Asian Dragon and Volvo S60 should we start with?
Audio and video technology development weekly | 255
The interviewer asked me: how much do you know about MySQL's storage engine?
Numpy quick start
Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式
hcip第六天笔记
From input URL to web page display
Pycharm cannot input Chinese solution
LabVIEW的内部错误
mujoco_ Py Chinese document
Turn off automatic update when brew executes commands
QGIS加载在线地图:高德、天地图等
刷题-洛谷-P1085 不高兴的津津
包管理 apt,dpkg