主题:我的天呀! URAL1484 各位高手帮帮忙啦
这道题看起来很简单 可是我已经devote一个下午了 现在还test12WA 帮帮忙吧
1484. Film rating
Time Limit: 1.0 second
Memory Limit: 16 MB
Denis is an expert film fan. He goes to a cinema to watch all films which get high rating at his favorite film-fan Web site. Usually he is satisfied with films, but today, after yet another contest at the Petrozavodsk Training Camp, he has watched a film narrating the hard lot of narfs, scrunts, and tartutics. Denis didn't like the film at all. Now he wants to lower the rating of this film at the Web site, so that other film fans won't go to a cinema to watch such a dreadful film.
Denis是一个专业的影迷。他将要去电影院看所有在他的影迷网站得到高评价的电影。通常,他会对这些电影很满意 但是今天,在 Petrozavodsk的另一场比赛后 他看了一场电影描述narfs, scrunts, and tartutics(不知道什么意思) Denis根本不喜欢这部电影,现在他想让这个电影在他网站上的评价变低,这样就不会有其他的影迷来看这部无聊的电影了。
The rating of a film is determined as follows: each site visitor may estimate a film and give it a mark, which is an integer from 1 to 10. A film's rating is the arithmetic average of the marks given by visitors rounded to one fractional digit (for example, 7.54 is rounded to 7.5, and 7.55 and 7.58 are rounded to 7.6). Denis can see that now the film has been estimated by N visitors and its rating is X. He wants the rating to become not greater than Y. It remains to determine how many times Denis must estimate the film in order to achieve this goal.
电影的评价由以下几点决定:每个网站的访问者会通过给一部电影打一个分来评价这个电影,这个分是一个从1 到10的整数。一部电影的评价分是所有给它打分的影迷的分数的平均分并四舍五入到一位小数 如7.54会写为7.5 而7.55写为7.6. Denis现在可以看到这部电影被n位影迷评价并且它的影评分是x 他希望这部电影的影评可以小于y 程序希望可以求出Denis至少需要评价这部电影几次来使他的目标达成。
Input
The only line of the input file contains the numbers X, Y, and N. The numbers X and Y are given with one fractional digit. 1 ≤ X, Y ≤ 10. 1 ≤ N ≤ 1000000.
输入x,y,n x y由一位小数的形势给出1 ≤ X, Y ≤ 10. 1 ≤ N ≤ 1000000.
Output
Output the minimal number of votes that is needed to guarantee that the rating becomes not greater than Y. If it is impossible to do this, then output “Impossible”.
输出最小的投票次数可以保证影评分会小于y 如果不可能那么就输出 Impossible
Sample input
9.5 2.0 12
output
86
注意9.5 它的实际平均分可以是9.499999 还有如果要使平均分达到1.0 那么只要达到1.049999就可以了.
我的程序:
var
x,y,s,cha:real;
n,s1,i:longint;
begin
readln(x,y,n);
if x<=y then begin writeln(0); exit; end;
if (y<1) or (x>10) then begin writeln('Impossible'); exit; end;
if x<>10 then x:=x+0.049999;
y:=y+0.05;
s:=(x-y)*n/(y-1);
s1:=trunc(s);
while ((round((s1+x*n)*10/(s1+n))/10>y) and (s+100000>=s1)do
inc(s1);
if s1>=s+100000 then writeln('Impossible') else
writeln(s1);
end.
呵呵其实本来想偷偷懒过了算了 可是怎么也过不了test12了
顺便问一下 测试数据怎么可以知道啊?还是不可能知道?可是那些发测试数据的人从哪里拿到的啊?帮帮忙啦!谢啊!
1484. Film rating
Time Limit: 1.0 second
Memory Limit: 16 MB
Denis is an expert film fan. He goes to a cinema to watch all films which get high rating at his favorite film-fan Web site. Usually he is satisfied with films, but today, after yet another contest at the Petrozavodsk Training Camp, he has watched a film narrating the hard lot of narfs, scrunts, and tartutics. Denis didn't like the film at all. Now he wants to lower the rating of this film at the Web site, so that other film fans won't go to a cinema to watch such a dreadful film.
Denis是一个专业的影迷。他将要去电影院看所有在他的影迷网站得到高评价的电影。通常,他会对这些电影很满意 但是今天,在 Petrozavodsk的另一场比赛后 他看了一场电影描述narfs, scrunts, and tartutics(不知道什么意思) Denis根本不喜欢这部电影,现在他想让这个电影在他网站上的评价变低,这样就不会有其他的影迷来看这部无聊的电影了。
The rating of a film is determined as follows: each site visitor may estimate a film and give it a mark, which is an integer from 1 to 10. A film's rating is the arithmetic average of the marks given by visitors rounded to one fractional digit (for example, 7.54 is rounded to 7.5, and 7.55 and 7.58 are rounded to 7.6). Denis can see that now the film has been estimated by N visitors and its rating is X. He wants the rating to become not greater than Y. It remains to determine how many times Denis must estimate the film in order to achieve this goal.
电影的评价由以下几点决定:每个网站的访问者会通过给一部电影打一个分来评价这个电影,这个分是一个从1 到10的整数。一部电影的评价分是所有给它打分的影迷的分数的平均分并四舍五入到一位小数 如7.54会写为7.5 而7.55写为7.6. Denis现在可以看到这部电影被n位影迷评价并且它的影评分是x 他希望这部电影的影评可以小于y 程序希望可以求出Denis至少需要评价这部电影几次来使他的目标达成。
Input
The only line of the input file contains the numbers X, Y, and N. The numbers X and Y are given with one fractional digit. 1 ≤ X, Y ≤ 10. 1 ≤ N ≤ 1000000.
输入x,y,n x y由一位小数的形势给出1 ≤ X, Y ≤ 10. 1 ≤ N ≤ 1000000.
Output
Output the minimal number of votes that is needed to guarantee that the rating becomes not greater than Y. If it is impossible to do this, then output “Impossible”.
输出最小的投票次数可以保证影评分会小于y 如果不可能那么就输出 Impossible
Sample input
9.5 2.0 12
output
86
注意9.5 它的实际平均分可以是9.499999 还有如果要使平均分达到1.0 那么只要达到1.049999就可以了.
我的程序:
var
x,y,s,cha:real;
n,s1,i:longint;
begin
readln(x,y,n);
if x<=y then begin writeln(0); exit; end;
if (y<1) or (x>10) then begin writeln('Impossible'); exit; end;
if x<>10 then x:=x+0.049999;
y:=y+0.05;
s:=(x-y)*n/(y-1);
s1:=trunc(s);
while ((round((s1+x*n)*10/(s1+n))/10>y) and (s+100000>=s1)do
inc(s1);
if s1>=s+100000 then writeln('Impossible') else
writeln(s1);
end.
呵呵其实本来想偷偷懒过了算了 可是怎么也过不了test12了
顺便问一下 测试数据怎么可以知道啊?还是不可能知道?可是那些发测试数据的人从哪里拿到的啊?帮帮忙啦!谢啊!