vj p1041神风堂人数 题解
枚举可能出现的人数,因为要求最少,所以从最小开始枚举
但是有个精度的问题......解决的方法就是加0.000000001.....无语的方法...
代码如下:
1 var p,q,i,k,m:real;t:longint;
2 over:boolean;
3 begin
4 readln(p,q);
5 p:=p/100+0.000000001;q:=q/100-0.000000001;
6 i:=0;
7 over:=false;
8 while not(over) do
9 begin
10 i:=i+1;
11 k:=i*p;
12 m:=i*q;
13 t:=trunc(m);
14 if t>k then
15 begin
16 writeln(i:0:0);
17 over:=true;
18 end;
19 end;
20 end.
2 over:boolean;
3 begin
4 readln(p,q);
5 p:=p/100+0.000000001;q:=q/100-0.000000001;
6 i:=0;
7 over:=false;
8 while not(over) do
9 begin
10 i:=i+1;
11 k:=i*p;
12 m:=i*q;
13 t:=trunc(m);
14 if t>k then
15 begin
16 writeln(i:0:0);
17 over:=true;
18 end;
19 end;
20 end.