Timus 1011. The minimum total population of yecatalinburg is calculated based on the percentage of conductor members.
1011. conductors
Time Limit: 2.0 second
Memory limit: 16 MB
Background
Everyone
Making translations from English to Russian knows an English phrase
"Naked conductor runs along the bus". It has two very different
Meanings.
Problem
Every bus in the Ekaterinburg City has a special man (or woman) called
Conductor. When you ride the bus, you have to give money to the conductor.
We know that there are more thenP% Conductors and less thenQ% Conductors.
Your task is to determine a minimal possible number of Ekaterinburg citizens.
Input
Two numbersP,QSuch that 0.01 ≤P,Q≤ 99.99. numbers are given with 2 digits precision. These numbers are separated by some spaces or "end of line" symbols.
Output
The minumal Number of Ekaterinburg citizens.
Sample
The answer is as follows:
1 using system;
2 using system. Text. regularexpressions;
3 using system. Threading;
4 using system. Globalization;
5
6 namespace skyiv. Ben. timus
7 {
8 // http://acm.timus.ru/problem.aspx? Space = 1 & num = 1011
9 sealed class t1011
10 {
11 static void main ()
12 {
13 thread. currentthread. currentculture = cultureinfo. invariantculture;
14 string [] Ss = RegEx. Split (console. In. readtoend (). Trim (), @ "\ s + ");
15 decimal low = decimal. parse (ss [0])/100;
16 decimal high = decimal. parse (ss [1])/100;
17 decimal C1 = 0, C2 = 0;
18 int N;
19 For (n = 1; n ++)
20 {
21 C1 + = low;
22 C2 + = high;
23 decimal C0 = decimal. Ceiling (C1 );
24 if (C1 <C0 & C0 <C2) break;
25}
26 console. writeline (N );
27}
28}
29}
Note that in the above program, decimal cannot be replaced by double, because the precision of double is not enough, it will lead to "Wrong answer ".
In addition, the 13th rows in the program cannot be omitted, because the server of the online question bank of the Russian University of Ural is a Russian server. If the 13th rows are omitted, the row will be changed:
Thread. currentthread. currentculture = cultureinfo. getcultureinfo ("Ru-Ru ");
In this way, the program uses a comma (,) instead of a period (.) as the decimal point. The decimal. parse (ss [0]) of the 15th row will lead to the program "crash ".