|  | 
|  | 
| | I'm expected brute force solution will accepted on C++, because N * 10^D integer divisions might work in 1 sec, but this solution work even on Python3.Why is work? Is there a math prove that answer will be very small or in this problem weak tests?
 
 Edited by author 14.02.2023 17:29
I have WA 5 again and again. I tried all the test from this forum. I use neither double nor float, but still WA. I don't  know how to deal with it. Can you give me some tests with answers? Oh, finally! AC! To all, who have WA5: try this test2 1
 0.13
 Correct answer is 8.
 
 Thank You very much!!! It's really very useful test! :)    I got WA#10.And I don't know why~~~
 Thank you very much!!!
 A test for you5 3
 322.58065
 103.03226
 74.29032
 
 The answer is 31.
 Good luck!
5 50.00000
 0.03138
 0.86105
 0.20258
 0.27292
 
 5 50
 0.67165
 0.31869
 0.16180
 0.37224
 0.42567
 0.08201
 0.47479
 0.07057
 0.84085
 0.05972
 0.29330
 0.91728
 0.36791
 0.77466
 0.32793
 0.69767
 0.84417
 0.71798
 0.30664
 0.16263
 0.32950
 0.46602
 0.24665
 0.82568
 0.27903
 0.48177
 0.14918
 0.87434
 0.28729
 0.77275
 0.97646
 0.49253
 0.88794
 0.82728
 0.02030
 0.14106
 0.14350
 0.50081
 0.02168
 0.59293
 0.00965
 0.77448
 0.65066
 0.77049
 0.70811
 0.55751
 0.20603
 0.68109
 0.59285
 0.95546
 5 50.00000
 0.03138
 0.86105
 0.20258
 0.27292
 The answer is 12652.
 
 5 50
 0.67165
 0.31869
 0.16180
 0.37224
 0.42567
 0.08201
 0.47479
 0.07057
 0.84085
 0.05972
 0.29330
 0.91728
 0.36791
 0.77466
 0.32793
 0.69767
 0.84417
 0.71798
 0.30664
 0.16263
 0.32950
 0.46602
 0.24665
 0.82568
 0.27903
 0.48177
 0.14918
 0.87434
 0.28729
 0.77275
 0.97646
 0.49253
 0.88794
 0.82728
 0.02030
 0.14106
 0.14350
 0.50081
 0.02168
 0.59293
 0.00965
 0.77448
 0.65066
 0.77049
 0.70811
 0.55751
 0.20603
 0.68109
 0.59285
 0.95546
 
 The answer is 84779.
 Thank you!I was trying write my solution with long arithmetics
 But I see the answers is small:)
 I have WA5I don't understand why
 
 my prog returns
 
 1 1
 0.0
 -----
 0
 
 1 1
 1000.1
 -----
 7
 
 5 1
 1.54321
 ----
 81
 
 5 1
 1000.00001
 -----
 66667
 
 2 5
 1000.11111
 1000.99999
 -----
 66673
 
 5 10
 1000.00000
 1000.11111
 1000.22222
 1000.33333
 1000.44444
 1000.55555
 1000.66666
 1000.77777
 1000.88888
 1000.99999
 -----
 66673
 5 21000.11111
 1000.99999
 -----
 66673
 
 I think it should be 66670
 Do you think so???
 Yes you are rightMy prog returns 66670
 
 But I think I have problems with accuracy
 I don't know how to avoid it
 
 I use this way
 (from sample)
 
 if  round(round(52.29*7)/7*100) = round(52.29*100) then ..
 
 
 How I should calc
 
 Please help me
 
 To solve should use math, _int64 and don't use doubleand rounding.
 Let K=10^(d+1);S[i]- double ratios;i=1..N
 __int64 N[i]=S(i)*K;
 j-is good groop number if and only if
 ceil((N[i]-5)*j)/K)<=floor(([N[i]+5)*j)/K))
 if [(N[i]+5)*j]%K>0
 and
 ceil((N[i]-5)*j)/K)<=floor(([N[i]+5)*j)/K))-1 othewise
 
 Edited by author 05.03.2007 17:17
 to svr : Thank you very much!:)I was trying write my solution with long arithmeticsBut I see the answers is small:)
 Obviously, answer is not bigger than 100000, because we can always get necessary precision by picking 100000*avg things...Use following"k:=trunc(a[j]*i+0.5);
 if trunc(k/i*t+0.5)<>trunc(a[j]*t+0.05) then"
 don't use round
 
 Edited by author 11.03.2007 06:47
 But I used round and got AC(0.984)!
 This is my method:
 
 // find number c
 x:=1;
 for i:=1 to c do
 x:=x*10;
 c:=x;
 
 procedure test;
 var i:integer;
 e,q,f:real;
 begin
 for i:=1 to 100000 do begin
 q:=e*i;      // e is a[n]
 f:=round(q);
 if round(f/i*c+0.00000001)=z then...
 
 So, it's work! :)
 YeahI just meant using round is easy to get WA.
 But It seems that you are careful enough to use round :)
My program has passed all the tests offered here, but it's WA#5 still. I don't understand why. Can anyone offer harder tests? It is possible to solve using 'int' data type and track quotients/remainders with each increment. Just +- and comparisons inside main loop. Also, no 64 bit stuff is necessary. 5 50.00000
 0.03138
 0.86105
 0.20258
 0.27292
 
 This test is invalid because all input numbers are positive (I also checked Russian version, it's more clear from that one)
 
 But if this test would be valid, correct answer is 200001 because 1/12652 becomes 0.00001 after rounding :)
 
 Edited by author 19.08.2008 07:09
Abandon double (and optionally __int64) at all!
 scanf("%*d.%d", &r);
 is enough to get everything precisely.
 
 Edited by author 19.08.2008 07:11
 
 Edited by author 19.08.2008 07:11
WA5 can sb give me some hints?wa5 again and again
 The same problemI can't find mistake:(
 try this test1 4
 1.0
 2.1
 3.2
 4.5
 
 the right answer is 10
 thank you so much !!!!!!!!!!
 I finally find the problem.
 I use function round first.But it has bug!
 e.g. round(3.5)=3(<>4) round(3.6)=4
 p.s. I use pascal.
 
 thx again
 
First. Is requied number more than 0?Second. Please, give me several tests for correction my program (I don't use round-up and my code pass all tests of this forum).
 Obviously it's positive, otherwise division is not well defined. Also, my algo would always output 0 if I allow it to test this value :)Is this correct?
 1 1
 0.0
 Answer:1
 
 Yes Do you know what is test #16?I have WA on it...
 Quote:All the averages are POSITIVE and do not exceed one thousand; each of them is a fraction rounded exactly to d decimal digits.
 averages s[i] should be positive, but round(s[i]) may be equal to 0.0Can you explain the task?I don't understand, why cann't we answer 6.
How could i read double without crash?I use double.Parse(Console.ReadLine());
 | 
 | 
|