|
|
сколько у кого на тесте 6 60 30 20 10 0 0 ?? 54 27 18 0 0 0 Aleksandr Kim: You got AC? Edited by author 15.10.2011 17:30 wrong answer 4 Make sure you round the numbers down. I got wa 4 too. 73 21 4 0 0 0 But i have WA#9 73 21 4 0 0 0 but i have wa#9 My AC program gives 73 21 4 0 0 0 сколько у кого на тесте 6 60 30 20 10 0 0 ?? My code give : 50 25 16 8 0 0 The right answer for 6 60 30 20 10 0 0 is 73 21 4 0 0 0 I can confirm it with a code that got AC. If you get that result, and still get WA9 - add 0.00001 to the result before you cast it to int. Any one yes test? how about this one sample 5 5 3 3 3 3 ? this ans right 76 5 5 5 5? Edited by author 15.10.2011 14:59 I have 76 5 5 5 5 too, but WA#9 also too my solution also WA 9 test 76 5 5 5 5 too Edited by author 15.10.2011 15:59 Edited by author 15.10.2011 15:59 Mine gives 76 6 6 6 6 but WA 4 :) Edited by author 15.10.2011 16:19 my solution also WA 9 test 76 5 5 5 5 too mine gives 100 0 0 0 0 You've got the AC? as may be the answer? if all friends and Dan drank equally, then each are drank at 2.8 liters => each of them has bought more than drinking sorry for bad english :) I think it should be 100 0 0 0 0. Because everyone drank 3,8l and 4 of them bought 3l and Dan doesn't have to pay them. Edited by author 15.10.2011 17:10 Why? They brought 5+3+3+3+3 = 17, so everyone drank 17/6 = 2,8(3). George_Aloyan[PTSObninsk] is rigth This wtf situation from precision. Эта всё из-за точности. For example: Например: 4.99999999999999999999999999 But in real this is 5. When this are arounded in floor we get 4. Но на самом деле это число 5. А при округлении вниз получаем 4. So! Итак! This get WA9 floor(100.0*(a[i]-half)/mt); But this get AC floor(100.0*(a[i]-half)/mt+0.0001); P.S.: get 10 times WA9 =) Edited by author 15.10.2011 18:19 Edited by author 15.10.2011 18:19 Edited by author 15.10.2011 18:20 This wtf situation from precision. But this get AC floor(100.0*(a[i]-half)/mt+0.0001); Thank you very much. AC Thanks a lot, but really a strange situation)I understand the problem now, but... *Started reversing my solution* :) +0.0001 gave me WA#11 but +0.00001 gives AC ;) Friends! Problem can be solved easy in int type only without any 0.0001 and so on. Multiply all by common denumenators and have joy of AC. min multiplied coefficient is 5 - to get the AC=)(on Java) on c++ I used coefficient - 1000 Edited by author 15.10.2011 22:00 Thanks, I had a WA#5, added +0.0001 and got AC Hi, everyone! I had WA#9 too, but I wrote 'long double' instead of 'double' and got AC. It means it was precision's trouble. Edited by author 23.11.2017 18:25 I had the same problem. changing double to long double didn`t help, but adding 0.0001 to the result before casting it to int got my code AC. Apparently it`s an epsilon problem. AC program 76 5 5 5 5 My AC program answers to the test:5 5 3 3 3 3 76 5 5 5 5 too. I have problems with english. Sorry for example you answer is = int(ans) but use int(ans + 0.00001) and you will get AC you can implement your simple fraction class and use it instead of floating point numbers #include <iostream> using namespace std; int main() { int n; cin>>n; double a[n]; double s=0; for (int i=0;i<n;i++) {cin>>a[i];s+=a[i];} double sr=s/(n+1);double p=0; for (int i=0;i<n;i++) if (a[i]>sr) {p+=a[i]-sr;} for (int i=0;i<n;i++) { if (a[i]>sr) cout<<(int)(100*(a[i]-sr)/(p-0.0001))<<" "; else cout<<"0"<<" "; } return 0; } If you have give me please test 10... I think this is right: if (a[i]>sr) cout<<(int)(100*(a[i]-sr)/p + 1e-10)<<" "; Edited by author 18.10.2014 17:28 1: be careful of float point... 2: if there are K guys paid more than they drinked, the answer shouldn't be 100.0 / k, you should consider how much they paid... Следует считать, что Ден оплатил весь сок, выпитый не теми людьми, которые его покупали, а не только сок, выпитый им самим. выпитый не теми людьми а не только сок NO LOGIC Edited by author 07.05.2012 17:52 Ну смотри, по тесту: 6 60 30 20 10 0 0 всего - 120л. сока, каждый выпил по 17.1428...л. дак вот Ден платит не за 17.1428...л., а за 17.1428...(то что выпил он) + 17.1428...-10(четвертый человек) + 17.1428...-0(пятый) + 17.1428...-0(шестой) = 58.5713..л. Edited by author 07.05.2012 18:24 what does fairly mean equally evenly fifty-fifty how about this one sample 6 4 3 3 1 1 0 Edited by author 15.10.2011 16:43 Mine gives 47 26 26 0 0 0... I've WA#9 it's my 40 30 30 0 0 0 Edited by author 15.10.2011 17:27 Edited by author 15.10.2011 17:27 AC program 47 26 26 0 0 0 how about this one sample 6 4 3 3 1 1 0 My code give : 33 25 25 8 8 0 Edited by author 02.12.2011 01:19 Почему в тестовом примере: 3 10 10 10 Все получают поровну, если они все купили поровну и выпили столько же!Зачем им платить?Ведь они выпили столько сколько и купили. Все выпили по 30/4 = 7.5, т.к. сам Ден не ездил за соком. for 100 2 1 1 1 1 ..{98 times total}.. 1 1 1 0 ? Edited by author 15.10.2011 17:09 mine 67 32 Any more results? Why does the answer on this test contain only two numbers? I think there should be 100 numbers Edited by author 15.10.2011 18:04 Edited by author 15.10.2011 18:05 other is 0, mine: 51 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 I have 50 0 0 0..{99 times}..0 0 0 Is it right? I have 50 0 0 0..{99 times}..0 0 0 Is it right? No. Answer equal 51 0 0 ... {99 times} 0 Answer: 2-100/101=102/101 98*(1-100/101)=98/101 98/101+102/101=200/101 (102/101):(200/101)=(102/101)*(101/200)=102/200 (102/200)*100=102/2=51 PS: But memoring in computer in type double 51 as 51.00000000001 or 50.999999999999999. Because you got 50, when answer 51. Wrong accuracy you got. Don't used double. Used only int, or should add epsilon (0 < epsilon < 1e-12) why WA on 3 test? Not all friends should get money from DAN and...??? And you should give them their money not thinking of ALL the liters someone brought, but of the liters he paid, but didn't drink. E.G. var k, i, s, n: longint; a: array[1..100] of longint; begin readln(n); for i :=1 to n do begin read(a[i]); s := s + a[i]; end; for i := 1 to n do begin write((a[i]*100) div s, ' '); end; end. - WA3 var k, i, s, n: longint; a: array[1..100] of longint; begin readln(n); for i :=1 to n do begin read(a[i]); s := s + a[i]; end; s := s div (n + 1); for i := 1 to n do a[i] := a[i] - s; s := 0; for i := 1 to n do if a[i] > 0 then s := s + a[i]; for i := 1 to n do begin if (a[i] > 0) then write((a[i]*100) div s, ' ') else write('0 '); end; end. - WA6. And then I came to WA 9) I've done some more mistakes, for example i must calculate real numbers, but i did everything with integer, but it is discussed in sime other topics Edited by author 15.10.2011 18:37 3 0 0 0 This is wrong input because sum of all a[i] must be > 0 |
|
|