当前位置:网站首页>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;
}
边栏推荐
- Zzuli:1059 highest score
- 天谋科技 Timecho 完成近亿元人民币天使轮融资,打造工业物联网原生时序数据库
- Find specified characters
- Timecho of Tianmou technology completed an angel round financing of nearly 100 million yuan to create a native timing database of the industrial Internet of things
- SSH访问控制,多次失败登录即封掉IP,防止暴力破解
- 7-16 find the set of integers that meet the given conditions
- 洛谷P5194 [USACO05DEC]Scales S 题解
- Selective sorting
- Tonybot humanoid robot starts for the first time 0630
- Zzuli:1040 sum of sequence 1
猜你喜欢

pyQt界面制作(登录+跳转页面)

Four data flows and cases of grpc

Why is this error reported when modifying records in the database

tonybot 人形机器人 红外遥控玩法 0630

Zhonggan micro sprint technology innovation board: annual revenue of 240million, net loss of 17.82 million, proposed to raise 600million

Tailing rushes to the scientific and Technological Innovation Board: it plans to raise 1.3 billion, and Xiaomi Changjiang is the shareholder

tonybot 人形机器人 首次开机 0630

Creation of data table of Doris' learning notes

Programming language: the essence of type system

分布式事务(Seata) 四大模式详解
随机推荐
Sendmail can't send mail and it's too slow to send. Solve it
洛谷P5018 [NOIP2018 普及组] 对称二叉树 题解
ShowMeBug入驻腾讯会议,开启专业级技术面试时代
【北大青鸟昌平校区】互联网行业中,哪些岗位越老越吃香?
NPM install is stuck with various strange errors of node NPY
Tonybot humanoid robot starts for the first time 0630
修改数据库中的记录为什么报这个错
Get permissions dynamically
556. The next larger element III: simple construction simulation questions
String reverse order
Optical cat super account password and broadband account password acquisition
7-15 calculation of PI
适用于XP的DDK
洛谷P5194 [USACO05DEC]Scales S 题解
动态获取权限
Luogu p5536 [xr-3] core city solution
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
tonybot 人形机器人 红外遥控玩法 0630
Doris学习笔记之数据表的创建
Luogu p3065 [usaco12dec]first! G problem solution