TORONTO KIDS COMPUTER CLUB | Aurora Saturday 14:30 Python Practice 20.07.04.
17860
post-template-default,single,single-post,postid-17860,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

# Aurora Saturday 14:30 Python Practice 20.07.04.

## 08 Jul Aurora Saturday 14:30 Python Practice 20.07.04.

Question 1:
Winnie is feeling generous today, so she decided to adopt all the children in an orphanage. There are N orphanages, numbered from 1 to N, that she can choose from. Each orphanage has M children. Each children has a cuteness value ranging from 1 to 10. Winnie cannot handle children that are too cute, or children that are too ugly. Because of this, Winnie wants to choose the orphanage that has the least number of children with a cuteness value of 1 or 10. Can you help Winnie find this orphanage?

Input Specification
The first line of input will contains two integers N, M (1≤N, M≤1000), the number of orphanages and the number of children in each orphanage.

The next N lines will each contain M integers, representing the cuteness values of each children. Line i will represents from the children from orphanage i. The cuteness values are between 1 and 10, inclusive.

Output Specification
Output the index of orphanage with the least number of children with a cuteness value of 1 or 10. If multiple orphanages exists, output the one with the smallest index.

Sample Input
3 3
2 1 8
4 10 9
3 6 4

Sample Output
3

Explanation For Sample
The third orphanage has no children with a cuteness value of 1 or 10, while the first and second orphanages both have one children.

If you have finished the question 1, you could try the question 2:

Question 2:
People who study epidemiology use models to analyze the spread of disease. In this problem, we use a simple model. When a person has a disease, they infect exactly R other people but only on the very next day. No person is infected more than once. We want to determine when a total of more than P people have had the disease.

Input Specification
There are three lines of input. Each line contains one positive integer. The first line contains the value of P. The second line contains N, the number of people who have the disease on Day 0. The third line contains the value of R. Assume that P ≤ 107 and N P and R ≤ 10.

Output Specification
Output the number of the first day on which the total number of people who have had the disease is greater than P.

`Sample Input 175015Output for Sample Input 14Explanation of Output for Sample Input 1The 1 person on Day 0 with the disease infects 5 people on Day 1. On Day 2, exactly 25 people are infected. On Day 3, exactly 125 people are infected. A total of 1 + 5 + 25 + 125 + 625 = 781 people have had the disease by the end of Day 4 and 781 > 750.`

`Sample Input 21021Output for Sample Input 25Explanation of Output for Sample Input 2There are 2 people on Day 0 with the disease. On each other day, exactly 2 people are infected. By the end of Day 4, a total of exactly 10 people have had the disease and by the end of Day 5, more than 10 people have had the disease.`

##### No Comments

Sorry, the comment form is closed at this time.