Issue # 33: IT training – current issues and challenges from leading companies
In general, we consulted and decided this week to propose puzzles on the topic of … viruses
Calmly, you can’t get infected through their decisions.
Wash your hands, stay at home, do not touch your face, wait for answers to the problems exactly one week later.
P.S. Answers to problems from the previous issue have already been published.
Questions
1. Diseases and tests
Dinoo is worried that he might have a rare disease. He decides to get himself tested, and suppose that the testing methods for this disease are correct 99 percent of the time (in other words, if he has the disease, it shows that he does with 99 percent probability, and if he doesn’t have the disease, it shows that he does not with 99 percent probability). Suppose this disease is actually quite rare, occurring randomly in the general population in only one of every 10,000 people.
If his test results come back positive, what are his chances that he actually have the disease?A. 0.99
B. 0 .90
C. 0.10
D. 0.01
If the results of his tests are positive, what are his chances that he is really sick with this disease?
2. Strict Pill Schedule Problem
You are on a strict medical regimen that requires you to take two types of pills each day. You must take exactly one A pill and exactly one B pill at the same time. The pills are very expensive, and you don’t want to waste any. So you open the bottle of A pills and tap one out into your hand. Then you open the bottle of B pills and do the same thing – but you make a mistake, and two B pills come out into your hand with the A pill. But the pills are all exactly identical. There is no way to tell A pills apart from B pills. Is it possible to satisfy your regimen and take exactly one of each pill at the same time, without wasting any pills?
Tasks
1. The virus challenge in a bacterial colony
One virus enters a colony consisting of N bacteria. In the first minute, it destroys one bacterium, then divides into two new viruses. At the same time, each of the remaining bacteria is also divided into two new ones. The next minute, the two viruses that emerge destroy the two bacteria, and then both viruses and all the remaining bacteria divide again and so on.
Will this colony live forever under the indicated conditions or will it die in the end?
2. Sort the way!
A new deadly virus has infected large population of a planet. A brilliant scientist has discovered a new strain of virus which can cure this disease. Vaccine produced from this virus has various strength depending on midichlorians count. A person is cured only if midichlorians count in vaccine batch is more than midichlorians count of person. A doctor receives a new set of report which contains midichlorians count of each infected patient, Practo stores all vaccine doctor has and their midichlorians count. You need to determine if doctor can save all patients with the vaccines he has. The number of vaccines and patients are equal.
Input Format:
First line No of test cases t followed by contains the number of vaccines – N. Second line contains N integers, which are strength of vaccines. Third line contains N integers, which are midichlorians count of patients.
Output Format:
Print a single line containing ′ 1 ′ for Yes or ‘0’ for No.
Constraints:
1<=T<=150
1<=N<=10Strength of vaccines and midichlorians count of patients fit in integer.
Sample Input:
2
5
123 146 454 542 456
100 328 248 689 200
8
87 93 50 22 63 28 91 60
64 27 41 27 73 37 12 69Sample Output:
0
Input format:
The first line contains the number of tests t, followed by the number of vaccines - N. The second line contains N integers, which are the strength of the vaccines. The third line contains N integers, which are the amount of midichlorian in patients.
Output format:
Print a single line containing "1" for yes or "0" for no.
Limitations:1<=T<=150
1<=N<=10
The strength of the vaccines and the number of midi-chlorians in patients fit into an integer.
Sample input:2
5
123 146 454 542 456
100 328 248 689 200
8
87 93 50 22 63 28 91 60
64 27 41 27 73 37 12 69
Output Example:0
Answers to the tasks will be given during the next week - have time to solve it. Good luck