-->
当前位置:首页 > 题库

PROGRAMMING:Mask distribution

Luz5年前 (2021-05-10)题库580
In order to fight the menacing COVID19 New Coronavirus, various measures have been launched throughout the country to control the development of the epidemic. One important link is the issuance of masks.
For the need of distributing masks to the public, a small program has been launched in a city to let the public fill in the information and facilitate the work. The app collects all kinds of information, including the name, ID card, physical condition and submission time of citizens. However, due to the large amount of data, it needs to be screened and processed according to certain rules. Please write a program to output the mailing list of masks according to the given rules.
###Input format:
The first line of input is two positive integers $$d $$and $$p $$($$1 / Le D, P / Le 30 $$), indicating that there are data of $$d $$days, and the interval between two times of getting masks for citizens is at least $$p $$days.
Next, $$d $$block data, each block gives the application information of one day. The first line of the $$I $$block data ($$I = 1, cdots, D $$) is two integers $$t_ I $$and $$s_ i$$($$1 \le T_ i, S_ I / Le 1000 $$), which means there is $$t on day $$I $$_ I $$applications, total $$s_ I $$number of masks. Then $$t_ I $$line, each line gives an application information in the following format:
```
Name, ID number, physical condition, submission time
```
The given data constraints are as follows:
*'name' is a non empty string with no more than 10 spaces in length;
* the ID number is a non empty string with a length of not more than 20;
*'physical condition' is 0 or 1, 0 means conscious good, 1 means having related symptoms;
*The submission time is HH: mm, which is 24 hours (from '00:00' to '23:59'). For example, 09:08.). Note that the submission time of a given record is not necessarily orderly;
* the ID number name is different. The same ID number is considered the same person. The data is identical to the ID number.
The record requirements for issuing masks are as follows:
* the ID number must be 18 * * * * * (which can contain lead 0).
* if the same identity card number is applied successfully on $$i$$days, the next $$P$$days can not be applied again. In other words, if the application is successful on the $$I $, it can not be applied again until the $$I + P + 1 $;
*If both of the above two conditions are met, it shall be issued according to the order of submission time until all records are processed or $$s_ I've run out of places. If the submission time is the same, it is determined according to the order in which it appears in the list.
###Output format:
For each application record, each row will export the name and ID number of a person with a mask, separated by a blank space. The order shall be determined according to the order of distribution.
After the output is released, you need to export the name and ID number of the applicant with a legal record and 1 health status, separated by spaces. The order is determined according to the order in the application record. The same person only needs to output once.
###Input example:
```in
4 2
5 3
A 123456789012345670 1 13:58
B 123456789012345671 0 13:58
C 12345678901234567 0 13:22
D 123456789012345672 0 03:24
C 123456789012345673 0 13:59
4 3
A 123456789012345670 1 13:58
E 123456789012345674 0 13:59
C 123456789012345673 0 13:59
F F 0 14:00
1 3
E 123456789012345674 1 13:58
1 1
A 123456789012345670 0 14:11
```
###Output example:
```out
D 123456789012345672
A 123456789012345670
B 123456789012345671
E 123456789012345674
C 123456789012345673
A 123456789012345670
A 123456789012345670
E 123456789012345674
```
###Example explanation:
In the output, the first line to the third line is the part of the first day; The fourth and fifth elements are the parts of the second day; On the third day, there were no qualified citizens; The sixth line is the fourth day part. The last two lines output the persons who may have physical discomfort according to the order of occurrence.







answer:If there is no answer, please comment