当前位置:网站首页>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;
}
边栏推荐
- 7-19 check denomination (solve binary linear equation)
- 适用于XP的DDK
- Tailing rushes to the scientific and Technological Innovation Board: it plans to raise 1.3 billion, and Xiaomi Changjiang is the shareholder
- Puzzle (016.4) domino effect
- 7-16 find the set of integers that meet the given conditions
- Preliminary summary of structure
- 7-15 calculation of PI
- Luogu p4047 [jsoi2010] tribal division solution
- 7-17 crawling worms (break exercise)
- Tonybot humanoid robot infrared remote control play 0630
猜你喜欢

556. The next larger element III

论文分享:Generating Playful Palettes from Images

To improve efficiency or increase costs, how should developers understand pair programming?

Dllexport and dllimport

Understand the application scenario and implementation mechanism of differential segment

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

Talking about part of data storage in C language

使用并行可微模拟加速策略学习

分布式事务(Seata) 四大模式详解

Bibit pharmaceutical rushed to the scientific innovation board: annual revenue of 970000, loss of 137million, proposed to raise 2billion
随机推荐
Tonybot humanoid robot infrared remote control play 0630
Adc128s022 ADC Verilog design and Implementation
Four data flows and cases of grpc
ShowMeBug入驻腾讯会议,开启专业级技术面试时代
To improve efficiency or increase costs, how should developers understand pair programming?
dllexport和dllimport
Ultra simple mobile map development
Zzuli:1056 lucky numbers
Zzuli:1057 prime number determination
Dllexport et dllimport
一文了解微分段应用场景与实现机制
Detailed explanation of four modes of distributed transaction (Seata)
Why is this error reported when modifying records in the database
How to query the baby category of tmall on Taobao
Stop asking yourself if you are suitable for software testing
Niuke: crossing the river
Understand the application scenario and implementation mechanism of differential segment
SSH访问控制,多次失败登录即封掉IP,防止暴力破解
7-20 print 99 formula table (format output)
7-23 currency conversion (using array conversion)