Show all threads Hide all threads Show all messages Hide all messages |
My solution finally accepted! Some tests for your help | magicdranton | 1011. Conductors | 8 Feb 2023 14:47 | 1 |
50 50.1 Answer: 501 10 20 Answer: 6 0.05 5.02 Answer: 20 0.05 5 Answer: 21 99.98 99.99 Answer: 5001 25 50 Answer: 3 13 14.1 Answer: 15 92 93.4 Answer: 13 30.2 50.01 Answer: 2 0.01 0.02 Answer: 5001 45.55 45.56 Answer: 90 49.09 50.01 Answer: 2 0.01 99.99 Answer: 2 0.29 0.3 Answer: 334 60 70 Answer: 3 Edited by author 08.02.2023 14:48 |
USE e=0.000000001 to get AC | samplex | 1011. Conductors | 21 Apr 2022 19:48 | 3 |
With e=0.0000001 I have WA#14 with 0.000001 i got AC Me too. round(v, 6) in Python. |
why WA 3 test ? | Александр | 1011. Conductors | 24 Apr 2021 19:42 | 3 |
read(p,q); for i:=2 to 10000000 do begin a:=i/100*p; b:=i/100*q; a1:=trunc(a); b1:=trunc(b); if (b1-a1)>=0.99 then begin write(i); halt; end; end; why WA ? Edited by author 24.04.2021 19:44 |
For python users having RE1 | elsa.mathlover | 1011. Conductors | 10 Aug 2020 13:48 | 1 |
Input in the task looks like: 13 14.1 Not like: 13 14.1 So change input in your program to p,q=map(float, input().split()) |
To admins — Is english statement correct? | Andrej Bourgasov | 1011. Conductors | 16 Oct 2019 15:41 | 1 |
Hello! Seems there is a duplication in english statement of the problem: >> We know that there are more than P% conductors and less than Q% conductors of all citizens of Ekaterinburg. >>By percentage, we know that there are more than P% conductors and less than Q% conductors of all Russian citizens in this city |
В 22 ОШИБКА | diablahaker2004 | 1011. Conductors | 13 Feb 2019 02:18 | 5 |
получил АС, долго искал где долбанный баг, т.к. ТЕСТ 22 выдавал ошибку по времени, если у вас такая же проблема и вы используете преобразование double в int то в 22 тесте точность P и Q 3 знака, поэтому ТЛ и выдает, вероятно на вход подаются какие нибудь числа 22.333 и 22.334 удачи You are wrong! P and Q are given with up to 2 digits after decimal point in all tests. похожая фигня, точности 2 знаков после запятой не хватало, впилил третий знак, всё заработало |
[gcc] If you have WA#1 - don't use %zu in printf. Only %d (( | malegkin | 1011. Conductors | 13 Feb 2019 02:01 | 1 |
code like: size_t out = 0; printf ("%zu\n", out); result - > wa#1 ((( if i use printf ("%d\n", out); all test accepted (( Why? https://wandbox.org/ & gcc 7.1 - The first version works correctly ((( |
WA3's people look here! | STK@fire | 1011. Conductors | 27 Aug 2018 11:28 | 1 |
less than can't be equal! |
Максимальный ответ очень мал | Mahilewets | 1011. Conductors | 30 Jul 2017 10:23 | 2 |
Можно просто перебирать ответ наименьшего возможного, двойки, пока не найдем нужное значение. Для данного количества жителей можно за log этого количества по времени найти требуемое количество кондукторов. Здесь пишут про int_64, про "не использовать double" и "использовать epsilon=1e-9". В моём варианте такое не нужно Хватило int_32 и double. Никакого epsilon, сравнения непосредственно оператором <=. |
WA#6, help me plz!!! | quangduytr | 1011. Conductors | 13 Feb 2017 12:43 | 1 |
#include <bits/stdc++.h> using namespace std; float p,q,t1,t2,t3,l1,l2; int main() { cin>>p>>q; for(int i=1; i<=1000000; i++){ t1=(p*(float)i)/(float)100; t2=(q*(float)i)/(float)100; l1=(int)t1; l2=(int)t2; if(l1==t1||l2==t2||l1!=l2){ if(l1!=t1) l1=l1+1; for(int j=l1; j<=l2; j++){ t3=((float)j/(float)i)*(float)100; if(p-0.000001<t3&&t3<q+0.000001){ cout<<i; return 0; } } } } } |
Why WA #5? | nastya | 1011. Conductors | 5 Nov 2016 14:38 | 2 |
The follwing is my pgm. Could some give a test case not satisfied here? var s1,i:integer; f:boolean; a2,b2,a1,b1,a,b:real; begin f:=false; read(a); read(b); a1:=a/100; b1:=b/100; if b<>0 then i:=trunc(1/b1); a2:=a1*(i); b2:=b1*(i); while not f do begin if (((trunc(b2)<>trunc(a2)))and (frac(b2)<>0) then f:=true; a2:=a2+a1; b2:=b2+b1; i:=i+1; end; i:=i-1; writeln(i);
end. Got ac by using double not float by accepting the input, so wired. |
I got AC! Some hints | Felix_Mate | 1011. Conductors | 18 Aug 2015 13:18 | 1 |
1)Not use double format; 2)Use int64; |
What's the meaning of hint?? | zylm | 1011. Conductors | 2 Sep 2014 19:30 | 1 |
|
What can be wrong here? | Igor | 1011. Conductors | 17 Aug 2014 20:44 | 1 |
Submitted following solution, but WA on 1st test. I tried very different inputs and works fine actually. def get_input_number gets.chomp.to_f end def calculate_conductors(low_percent, high_percent) (2..10000).each do |citizens| konduktors = (low_percent*citizens).ceil if (low_percent*citizens < konduktors) && (konduktors < high_percent*citizens) return citizens end end end def prepare_input_and_go lower_border = get_input_number/100 upper_border = get_input_number/100 puts calculate_conductors(lower_border, upper_border) end prepare_input_and_go |
C++ program (严格按照题目来) | lz1 | 1011. Conductors | 29 Jun 2014 21:12 | 4 |
// 严格按照题目来 #include <stdio.h> #include <stdlib.h> #include <math.h> #include <algorithm> using namespace std; const int p = 10000; double xs, ys; int x, y, ans; int main(void) { scanf ("%lf%lf", &xs, &ys); ans = 1, x = y = 0; // 严格按照题目来 (more than ... ; less than ... ) ys -= 1E-10, xs += 1E-10; while (x == y) ans++, x = int (ans * xs) / 100, y = int (ans * (ys)) / 100; printf ("%d", ans); return 0; }
想知道为什么ys是减1E-10,而xs是加1E-10! 想知道为什么ys是减1E-10,而xs是加1E-10! because it said "more than P%" and "less than Q%", so it can't be equal, you have to shorten interval, just add or sub 1E-10 (因为题目是说“more than P%” 和 “less than Q%”,因此不能相等,所以两边的区间都要往里面再缩小一点,只要加或减1E-10就行) |
May program responds correctly. but why that's answered me Runtime error why? In JAVA 1.7 | Axmadjon | 1011. Conductors | 7 May 2014 12:05 | 1 |
import java.util.Scanner; public class _1011 { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); double p, q; p = Double.parseDouble(s.nextLine()); q = Double.parseDouble(s.nextLine()); p /= 100; q /= 100; answer(p, q, 1, 1, 0); } public static void answer(double p, double q, double m, double mp, long n) { long t = (long) (m / q) + 1; if (p * t < mp) { System.out.println(n + t); } else { answer(p, q, 1 - q * t + m, 1 - p * t + mp, n + t); } } } |
Runtime error | Grigorenko Vlad | 1011. Conductors | 17 Feb 2014 03:40 | 2 |
Why I have Runtime error? I use C#. Code is here. using System; using System.Globalization; class EntryPoint { static void Main() { CultureInfo ci = new CultureInfo("en-US"); double p = Convert.ToDouble(Console.ReadLine(),ci); double q = Convert.ToDouble(Console.ReadLine(),ci); int x = 1; while (true) { if ((int)(q * x / 100) - (int)(p * x / 100) > 0) break; x++; } Console.WriteLine(x); } } Quote from problem description: "These numbers are separated by some spaces or "end of line" symbols" |
WA #17 !!!!!!!!! | tqti | 1011. Conductors | 25 Oct 2013 00:07 | 2 |
#include<iostream> using namespace std; int main() { double p,q; cin>>p; cin.get(); cin>>q; long tmp_q = 1,tmp_p = 0; for(int i = 1;i < size_t(-1); ++i) { tmp_p = p * i * 100; tmp_q = q * i * 100; long res = (int)(tmp_p/10000); ++res; if(tmp_q % 10000 == 0) { if(res < (int)(tmp_q/10000)) { cout<<i<<endl; break; } } else { if(res <= (int)(tmp_q/10000)) { cout<<i<<endl; break; } } } } some hints?? where's the problem??? |
I need help(WA 17) | Mad man | 1011. Conductors | 15 Aug 2013 20:42 | 8 |
I do not see error here, but didn't pass the 17'th test var p,q: extended; a,b: longint; BEGIN read(p,q); p:=p/100; q:=q/100; a:=1; while (true) do begin b:=1; while (a/b>=q) do inc(b); if (a/b>p) then begin write(b); halt(0); end else inc(a); end; END. Me, too. I'm getting insane. AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!!!!!!!!!!!! Use epsilon! Instead of >= q and > p use >= q-eps and > p+eps and you'll get AC. Good luck! ;) ??? Use epsilon! Instead of >= q and > p use >= q-eps and > p+eps and you'll get AC. Good luck! ;) who can say me, what is epsilon??? how to use it Thank You!!! I got AC!!! with eps! |
IMPORTANT | earthworm | 1011. Conductors | 1 May 2013 05:25 | 1 |
The key here is "more than p, less than q", not "more than or equal to p, less than or equal to q" |