当前位置:网站首页>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
- Plane vector addition
- Luogu p4047 [jsoi2010] tribal division solution
- 7-17 crawling worms (break exercise)
- tonybot 人形机器人 查看端口并对应端口 0701
- 1017 a divided by B (20 points)
- MySQL multi table query subquery
- 7-4 BCD decryption (10 points)
- C language to realize mine sweeping
- 【7.3】146. LRU缓存机制
猜你喜欢

dllexport和dllimport

【北大青鸟昌平校区】互联网行业中,哪些岗位越老越吃香?

Showmebug entered Tencent conference, opening the era of professional technical interview

Doris学习笔记之数据表的创建

Niuke: crossing the river

天谋科技 Timecho 完成近亿元人民币天使轮融资,打造工业物联网原生时序数据库

US stock listing of polar: how can the delivery of 55000 units support the valuation of more than 20billion US dollars

Amazon, express, lazada, shopee, eBay, wish, Wal Mart, Alibaba international, meikeduo and other cross-border e-commerce platforms evaluate how Ziyang account can seize traffic by using products in th

亚马逊、速卖通、Lazada、Shopee、eBay、wish、沃尔玛、阿里国际、美客多等跨境电商平台,测评自养号该如何利用产品上新期抓住流量?

puzzle(016.3)千丝万缕
随机推荐
7-15 calculation of PI
Preliminary summary of structure
Zzuli:1055 rabbit reproduction
Use of constraintlayout
How to query the baby category of tmall on Taobao
X86 assembly language - Notes from real mode to protected mode
7-3 rental (20 points)
Luogu p4047 [jsoi2010] tribal division solution
Puzzle (016.4) domino effect
Talking about part of data storage in C language
Puzzle (016.3) is inextricably linked
MySQL multi table query subquery
[qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?
Find the sum of the elements of each row of the matrix
Zzuli:1044 failure rate
Luogu p5018 [noip2018 popularization group] symmetric binary tree problem solution
Luogu p5194 [usaco05dec]scales s solution
Add ZABBIX calculation type itemcalculated items
7-2 and then what time (15 minutes)
String reverse order