Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | some useful tests | RASTA | 1443. Рельсы | 8 авг 2012 18:34 | 4 | input 1 3 6.0000 3.0000 output 1 6 input 2 3 6.1000 3.0000 output 2 7 input 3 3 8.0000 3.0000 output 3 9 This test helped me get AC: 5 1.0000 0.0003 ~~~ 16667 | why WA#20 | Tbilisi SU: Andrew Lutsenko | 1443. Рельсы | 10 авг 2008 14:34 | 9 | why WA#20 Tbilisi SU: Andrew Lutsenko 27 мар 2006 20:23 Please give me some tests. I just can't find a mistake The deal in the accuracy. I had WA#20 too but I replace this in my program ost=s-a*l; with ost=(s*10000-a*l*10000)/10000; s,a,l - double THANX!!! I've got AC. This is an interesting artefact. In FreePascal I had wa even when i've added multiplying on 10000. Then in C++ it worked. Thank you once more. you method reading data not good better this: read line as string s remove '.' convert to long! that all. in other algo you know.. Strange, I did this thing, but got WA. I used the same trick with Conductors problem (1011) and was lucky. Are you sure that it's just enough to multiply numbers, convert them in long and use them (I assume we're discussing the C++ realisation). I used here long double, but it didn't help here. I multiplied by 1000 as it was said here, but WA Can smbd give data for this test 20? I solved it using 'int' type in C++ #define THR (1e-8) int n; double ss, ll; scanf("%d %lf %lf", &n, &ss, &ll); int s = (int)(ss*10000 + THR); int l = (int)(ll*10000 + THR); printf("%d\n", f(n, s, l)); This is my code... but I got wa#20 :( ... TYPE ReaL = Double; VAR N : integer; Ans, S, L : ReaL; PROCEDURE Run; Var Res, Q : ReaL; i : integer; Begin ReadLn(N); ReadLn(S); ReadLn(L); Ans := N * Int(S / L); Q := (S * 10000 - ((Ans / N) * L * 10000)) / 10000; Res := 0; i := 0; while (i < N) and (Q > 0) do begin inc(i); if (Res * 10000 - Q * 10000) / 10000 < 0 then begin Ans := Ans + 1; Res := (L * 10000) / 10000; end; Res := (Res * 10000 - Q * 10000) / 10000; end; WriteLn(Ans : 0 : 0); End; BEGIN Run; END. | Why WA7? | Cheryl Xie | 1443. Рельсы | 12 май 2008 18:05 | 3 | Who can give me information about test 7? Thank a lot! Could any one send me AC program to me? I Need You!!! Cheryl.Xir@Gmail.com Re: Why WA7? Olympic Bear (Nikolay Dubchuk) 12 май 2008 18:05 check your logic: you must find min amount of joints and after that min amount of rails | Just one thing... | Alexander Kouprin | 1443. Рельсы | 6 май 2007 16:31 | 2 | if you get WA#20 then set length of way like s:=s-0.0000001; It is better to use just integer numbers here. | What's wrong with my formula?! | Alexey | 1443. Рельсы | 26 июн 2006 14:31 | 7 | Readln(n); Readln(ss); delete(ss,pos('.',ss),1); Val(ss,s,r); Readln(ss); delete(ss,pos('.',ss),1); Val(ss,l,r); count:=(s div l)*n+((s mod l)*n) div l+1; Please... Precision is main trouble of this problem =) I will try to explain... When you read real number, for example 1.115, after reading you can get something like 1.11499999, and after custing to integer you'll get 1114 instead 1115. Just try different tests. Just give me your e-mail and I'll send you c++ source. I don't need your code! I want to understand mistake in my formula! Well. OK, Ok... you've talked me in :) _magistr.90@mail.ru | Wy WA 8? | Neo Nomaly | 1443. Рельсы | 26 мар 2006 16:29 | 1 | | prob description... | Hurricane_NET | 1443. Рельсы | 26 мар 2006 14:20 | 2 | it is not written in English?? Для удобства учеников Хогвартса решено продлить железную дорогу от станции Хогсмид до ворот замка. Волшебная N-колейная железная дорога поможет доставить учеников сразу к замку, что весьма уместно в связи с участившимися случаями нападений на людей после возвращения Волан-де-Морта. Дорога строится из рельсов фиксированной длины. В процессе прокладки дороги рельсы можно разрезать и/или соединять, причем при соединении двух рельсов или кусков рельсов появляется стык. Директор Хогвартса хочет, чтобы количество стыков было минимально возможным, а при выполнении этого условия количество потраченных рельсов было бы минимальным. Sorry, it will be fixed soon. For the convenience of Hogwarts students, it is decided to extend the railway from Hogsmeade station to the castle's gates. The magic $N$-track railway will take students right to the castle, which will be quite appropriate because of the increased frequency of attacks on people after Voldemort's return. The railway is to be built of rails of fixed length, which can be cut and joined. When two rails or rail pieces are joined, a joint appears. The Hogwarts Headmaster wants the number of joints to be minimal,and if this conditions is satisfied, then the number of the used rails should be minimal. Edited by author 26.03.2006 14:20 Edited by author 26.03.2006 14:21 |
|
|