当前位置:网站首页>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;
}
边栏推荐
- Niuke: crossing the river
- Creation of data table of Doris' learning notes
- Zhonggan micro sprint technology innovation board: annual revenue of 240million, net loss of 17.82 million, proposed to raise 600million
- 7-6 mixed type data format input
- 表单文本框的使用(一) 选择文本
- 7-23 currency conversion (using array conversion)
- Protobuf and grpc
- NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
- 洛谷P5018 [NOIP2018 普及组] 对称二叉树 题解
- Tailing rushes to the scientific and Technological Innovation Board: it plans to raise 1.3 billion, and Xiaomi Changjiang is the shareholder
猜你喜欢
ShowMeBug入驻腾讯会议,开启专业级技术面试时代
dllexport和dllimport
论文分享:Generating Playful Palettes from Images
retrofit
556. The next larger element III
Programming language: the essence of type system
Dllexport and dllimport
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
洛谷P4047 [JSOI2010]部落划分 题解
如何查询淘宝天猫的宝贝类目
随机推荐
洛谷P3065 [USACO12DEC]First! G 题解
Bibit pharmaceutical rushed to the scientific innovation board: annual revenue of 970000, loss of 137million, proposed to raise 2billion
Code writing and playing method of tonybot humanoid robot at fixed distance
Analysis of gene family characteristics - chromosome location analysis
天谋科技 Timecho 完成近亿元人民币天使轮融资,打造工业物联网原生时序数据库
基因家族特征分析 - 染色体定位分析
Ultra simple mobile map development
Zzuli:1058 solving inequalities
Understand the application scenario and implementation mechanism of differential segment
Adc128s022 ADC Verilog design and Implementation
7-17 crawling worms (break exercise)
Tonybot humanoid robot starts for the first time 0630
String sort
修改数据库中的记录为什么报这个错
556. The next larger element III: simple construction simulation questions
Four data flows and cases of grpc
Zzuli:1046 product of odd numbers
Common commands for getting started with mongodb database
Special research report on the market of lithium battery electrolyte industry in China (2022 Edition)
Table of mathematical constants by q779