当前位置:网站首页>NOI OPENJUDGE 1.5(23)
NOI OPENJUDGE 1.5(23)
2022-07-03 14:37:00 【two billion seven hundred and fifty-eight million seven hundred】
23: Pharmacy management
Total time limit :
1000ms
Memory limit :
65536kB
describe
Swine flu is not terrible , In China, , Its mortality rate is not very high . Please according to the deadline 2009 year 12 month 22 The number of confirmed cases and deaths of swine flu reported by all provinces in Japan , Calculate the mortality rate of influenza A in all provinces .
With the vigorous development of information technology , Medical informatization has become an indispensable part of hospital construction . Computers can help hospitals manage doctor information 、 Patient information 、 Massive data such as drug information , So that the staff can be liberated from the work of these machines , Put more energy into the real medical process , Thus, the overall work efficiency of the hospital is greatly improved .
The management of drugs is one of the important contents . Now the pharmacy administrator wants to use a computer to help him manage . Suppose for any drug , The total inventory at the beginning of each day has been know , And it will not be increased by purchasing within one day . Many patients come to take medicine every day , Each patient wants to take a different amount of Medicine . If the patient needs more than the inventory at that time , The pharmacy will refuse Refuse the patient's request . The administrator wants to know how many patients fail to take medicine every day .
Input
common 3 That's ok
The first line is the total amount of medicine at the beginning of each day m
The second line is the number of people taking medicine on that day n(0 < n <= 100)
The third line has n Number , The number of drugs each patient wanted to take was recorded separately ( In chronological order ), The two numbers are separated by spaces
Output
Only 1 That's ok , For the number of people who did not take medicine on this day .
The sample input
30
6
10 5 20 6 7 8
Sample output
2
Analysis and code :[ author : Lu changheel ]:
analysis : When a customer's needs are met , If the total number of pieces taken exceeds the total amount of drugs , Then skip the customer , That is, I didn't take the medicine , Then proceed to the next . And so on
Code :#include<iostream>
using namespace std;
int main()
{
int m,n,a[101],sumr=0,sum=0;
cin>>m;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(sum+a[i]>m)
{
sum=sum;
sumr++;
}
else
{
sum=sum+a[i];
}
}
cout<<sumr;
return 0;
}
边栏推荐
- 数学常数表 by q779
- MySQL multi table query subquery
- Get permissions dynamically
- Sub-GHz无线解决方案Z-Wave 800 系列ZG23 soc和ZGM230S模块
- 7-28 monkeys choose King (Joseph problem)
- Puzzle (016.4) domino effect
- 1017 a divided by B (20 points)
- Happy capital new dual currency fund nearly 4billion yuan completed its first account closing
- Talking about part of data storage in C language
- 关于敏捷的一些概念
猜你喜欢
Bucket sorting in C language
Tonybot Humanoïde Robot Infrared Remote play 0630
论文分享:Generating Playful Palettes from Images
Use of constraintlayout
Understand the application scenario and implementation mechanism of differential segment
使用并行可微模拟加速策略学习
Doris学习笔记之数据表的创建
Dllexport et dllimport
puzzle(016.4)多米诺效应
How to query the baby category of tmall on Taobao
随机推荐
Adc128s022 ADC Verilog design and Implementation
光猫超级账号密码、宽带账号密码 获取
Convert string to decimal integer
7-18 finding the single root of polynomial by dichotomy
Table of mathematical constants by q779
Luogu p4047 [jsoi2010] tribal division solution
ShowMeBug入驻腾讯会议,开启专业级技术面试时代
使用并行可微模拟加速策略学习
Luogu p5194 [usaco05dec]scales s solution
Zzuli:1054 monkeys eat peaches
【7.3】146. LRU caching mechanism
tonybot 人形机器人 红外遥控玩法 0630
7-4 BCD decryption (10 points)
Code writing and playing method of tonybot humanoid robot at fixed distance
Zzuli:1058 solving inequalities
China PETG market forecast and Strategic Research Report (2022 Edition)
表单文本框的使用(一) 选择文本
Tonybot humanoid robot starts for the first time 0630
556. The next larger element III
7-10 stack of hats (25 points) (C language solution)