Show all threads Hide all threads Show all messages Hide all messages |
Time limit exceeded?? | zsyzYYK | 1011. Conductors | 12 Apr 2011 22:46 | 2 |
Help! var p,q:extended; n,i:longint; b:boolean; begin readln(p); readln(q); p:=p*0.01; q:=q*0.01; n:=0;b:=false; repeat inc(n); for i:=1 to n do begin if ((i/n)>=p) and ((i/n)<=q) then begin b:=true; write(n); exit; end; end; until b=true; end. ok, my name is Xuan Dung, i come from viet nam. so why you don't user C/C++ programm for creat a programm. ok.. do Help! var p,q:extended; n,i:longint; b:boolean; begin readln(p); readln(q); p:=p*0.01; q:=q*0.01; n:=0;b:=false; repeat inc(n); for i:=1 to n do begin if ((i/n)>=p) and ((i/n)<=q) then begin b:=true; write(n); exit; end; end; until b=true; end. |
Ma program works well...But I get Wrong Answer. Plz help me | Rowka | 1011. Conductors | 7 Dec 2010 20:38 | 2 |
var p,q,q1:real; i,p1:integer; f:boolean; begin read(p); read(q); p:=p/100; q:=q/100; f:=true; i:=1; while f do begin inc(i); p1:=trunc(p*i)+1; q1:=q*i; if (p1<q1) then f:=false; end; writeln(i); end. I don't understand it too. I have like code |
10 lines,got AC :D | hoan | 1011. Conductors | 25 Oct 2010 14:23 | 2 |
#include <cstdio> void main (){ int res= 0, a1, a2; double p, q; scanf ("%lf%lf", &p, &q); do{ res ++,a1= (int)(p* (double)res)/100, a2= (int)(q* (double)res-(1e-7))/100; }while (a1== a2); printf ("%d\n", res); } Edited by author 25.10.2010 14:29 Edited by author 25.10.2010 14:29 |
(C++)Got WA on test14, can you help me? | Boqian Jiang | 1011. Conductors | 21 Mar 2010 00:07 | 2 |
#include <cstdlib> #include <iostream> #include <iomanip> using namespace std; int main(int argc, char *argv[]) {
double a,b,c,d,m,n=2,mn; cin>>a>>b; c=a/100; d=b/100; while (1) {m=1; while (m<n) {mn=m/n; if ((mn<d)&&(mn>c)) break; m++;} if (m!=n) break; n++;} cout<<n<<endl; system("PAUSE"); return EXIT_SUCCESS; } This is my project Got WA on test14. I think there's something wrong with digits But i cannot find it Can anyone help me with it? Thx! I think, your mistake in precision. Try change: if ((mn<d)&&(mn>c)) -> if ((mn+eps<d)&&(mn-eps>c)) |
How to reduce the execution time to minimum? | rainforest | 1011. Conductors | 9 Feb 2010 00:58 | 1 |
My best execution time is 0.015s, how can I improve the performance? Thanks a lot! |
use extended,not real. | panfei | 1011. Conductors | 22 Oct 2009 12:59 | 2 |
1、Use extended,not real,and you'll get AC. If you want to know why,you can readln some real like 100/100 and use WATCH to check it in the program.You may find that the number change to someting like"1.0000000001"or"0.99999999998". 2、Take care of the description:less than q%.Less than!!!! So:if trunc((i*q/100))=(i*q/100) then continue;
use integer, not float then EPS = 1/50000 (if p = P*500, q = Q*500, else if for p and q to take a multiplier smaller, for example 200 and to divide on 20000, we will receive WA 22 (40 -> WA 23)) |
Please give me test 21. | D_PRO | 1011. Conductors | 6 Oct 2009 11:52 | 1 |
|
Whats the 5th test is? | AC-SKYDOS | 1011. Conductors | 5 Oct 2009 23:08 | 3 |
Stop flooding try to think! if i use float, get wa5 when i use double - get ac |
test 3 | AC-SKYDOS | 1011. Conductors | 12 Sep 2009 23:37 | 3 |
test 3 AC-SKYDOS 17 Jul 2009 23:43 is it possible p = q? what should I output when q = p? q = 10 p = 10 result 0 or 10? thanks I think "there are more then P% conductors and less then Q% conductors" means that "P < conductors < Q" => P and Q can't be equal. Moreover, my program just crashes, having "10 10" input, but I have AC. I had WA3 when my algorithm worked like "P < conductors <= Q". |
Be careful about this! | OIfan | 1011. Conductors | 23 Aug 2009 11:22 | 1 |
|
Why the answer is 15 | remdy21 | 1011. Conductors | 24 Jul 2009 13:04 | 3 |
I can't understand the problem well There must be at least one natural number between A = 0.01*P*N and B = 0.01*Q*N. You have to find minimal possible N. A = 0.13*15 = 1.95 B = 0.141*15 = 2.115 There is number 2 between A and B. But there is no natural numbers between A and B for all N<15. Thank you.now,I know the meaning. |
I dont understand test number 3 | AC-SKYDOS | 1011. Conductors | 17 Jul 2009 23:45 | 1 |
Whats wrong with my code? #include <stdlib.h> #include <math.h> #include <vector> #include <iostream> #include <string> #include <fstream> #include <algorithm> #include <utility> #include <stdlib.h> #include <set> using namespace std; bool normal (float, float); int main() { float begin, end, y1, y2; int counter = 1; scanf ("%f %f", &begin, &end); do{ y1 = (begin*counter)/100; y2 = (end*counter)/100; if (normal(y1, y2)){ printf ("%i\n", counter); return 0; } counter++; } while (true); return (0); } bool normal (float a, float b){ if (ceil(a)<=(float)b) return true; else return false; } |
WA#17 | Monyura (LYC) | 1011. Conductors | 25 Apr 2009 02:18 | 1 |
WA#17 Monyura (LYC) 25 Apr 2009 02:18 Can somebody tell me hints to this problem? What can be with this test? |
The sample output | Pedro LC | 1011. Conductors | 23 Apr 2009 13:31 | 2 |
I didn´t understand the anwser. How 15? If there are 15 citzens, what are the possible numbers of conductors? Thanks, Pedro. |
Why WA? | Alexander | 1011. Conductors | 25 Mar 2009 19:27 | 1 |
Why WA? Alexander 25 Mar 2009 19:27 #include <stdio.h> #include <math.h> #include <iostream> int det(const double a,const double b) { int i = (int)a; double x = floor(a*10000)/10000; while (i<x)i++; if (i>=1&&i<b&&i>x)return 1; else return 0; } int main() { double p,q; int c; scanf("%lf%lf",&p,&q); p = 100 / (p); q = 100 / (q); for (c=1;det(c*q ,floor(c*p+0.00001)) == 0 ;c++); printf("%.0lf\n", c*q ); return 0; } |
Test #3 WA | Coriu Radu | 1011. Conductors | 10 Mar 2009 12:25 | 3 |
I don't know why i keep getting WA. I tried many things but still WA. How can i get the test data? I remember that timus had a feature of sending an email with detailed data, but i can't find it anymore. Don't know how to pull out test data, but you must keep in mind that the total population is up to 20000, not 10000 as it might seem at first sight. For example, let P = .01%, Q = .02%, then there exists .015% that gives integer being multiplied by 20000. I didn't even think about the program limits, but my program works for large values, even millions. Don't know what the problem could be. |
if you use C# | renat | 1011. Conductors | 26 Jan 2009 20:04 | 1 |
apparently default culture on the server is such, that double as a string looks like 14,14 not 14.14. So Convert.ToDouble(input) will throw exception. To fix this use CultureInfo: CultureInfo ci = new CultureInfo("en-us"); low = Convert.ToDouble(input[0], ci); |
plz give me the 17th test...I get WA !!! | Roshka | 1011. Conductors | 6 Dec 2008 19:24 | 1 |
|
I don't understand this problem. plz help me | sahand | 1011. Conductors | 30 Nov 2008 13:15 | 2 |
i don't know what this problem say. it's AMBIGUOUS for me. Take into account that the number of conductors can not be a decimal fraction !!! |
To admins what's happening | Rustambek_UWED | 1011. Conductors | 4 Nov 2008 20:20 | 2 |
here my program what is the problem. tired of changing it. WA test#6: #include <iostream> #include <cmath> using namespace std; int main() { float p,q; long long int n=1; cin>>p>>q; p/=100.0; q/=100.0; while(ceil(n * q + 1e-9)-ceil(n*p + 1e-9)<1.0) n++; cout<<n; return 0; } Edited by author 04.11.2008 20:21 |