Search found 185 matches

by htl
Mon Jun 07, 2004 6:20 pm
Forum: Volume 102 (10200-10299)
Topic: 10289 - A Square and Equilateral Triangles
Replies: 27
Views: 8745

The value I calculated is the same as cooleye's but I got WA. But Scott's value could get AC. Could someone explain it?
by htl
Sun Jun 06, 2004 10:31 am
Forum: Volume 105 (10500-10599)
Topic: 10566 - Crossed Ladders
Replies: 39
Views: 12014

I use Newton's Method and got TLE. Why? I use the formula below:
b=a-(1/sqrt(x*x-a*a)+1/sqrt(y*y-a*a)-1/c)/(a/pow(x*x-a*a,1.5)+a/pow(y*y-a*a,1.5)+1/c/c)

When |a-b|<1e-6, I "should" got the answer. But I can't get it...
by htl
Sun Jun 06, 2004 4:52 am
Forum: Volume 103 (10300-10399)
Topic: 10378 - Complex Numbers
Replies: 25
Views: 13649

After debugging, I found that not only my comp but some wrong use of pointers :oops: But after I recode the comp as below, I still got wa. if(fabs((*(double **)a)[0]-(*(double **)b)[0])>Epsilon) { if((*(double **)a)[0]>(*(double **)b)[0]) return -1; else return 1; } if(fabs((*(double **)a)[1]-(*(dou...
by htl
Sat Jun 05, 2004 7:03 am
Forum: Volume 7 (700-799)
Topic: 795 - Sandorf's Cipher
Replies: 7
Views: 6388

795 - Sandorf's Cipher

I think it's a easy problem. Always getting WA. Could someone give me some test case?
by htl
Sat Jun 05, 2004 5:39 am
Forum: Volume 103 (10300-10399)
Topic: 10378 - Complex Numbers
Replies: 25
Views: 13649

After testing I found that there's something wrong with my comp function. Some outputs are correct but some are not. Could someone help me with my prog? #include<stdio.h> #include<math.h> #define Pi 3.14159265358979323846 int comp(const void*,const void*); void main(void) { char s[10]; int count,x,s...
by htl
Thu May 20, 2004 8:39 am
Forum: Volume 105 (10500-10599)
Topic: 10579 - Fibonacci Numbers
Replies: 8
Views: 4832

10579 - Fibonacci Numbers

On the ranklist I discovered that so many people spent much less time and memory to run the prog. But I took much time and memory doing this. Could someone teach me how to accelerate the prog?
by htl
Sat May 08, 2004 4:45 pm
Forum: Volume 106 (10600-10699)
Topic: 10649 - Danger Point
Replies: 10
Views: 2657

I just solved it... The distance between Karim or Rahim and the danger point could be ZERO...
by htl
Sat May 08, 2004 4:24 pm
Forum: Volume 106 (10600-10699)
Topic: 10649 - Danger Point
Replies: 10
Views: 2657

I use coordinate geometry to solve this. It's obvious that the four points is on the same circle. Defining the center of the circle as (0.0), I calculate the part in the circle of the line connected between Karim and Rahim. After calculating, I get a formula "s=sqrt(2*(r*r+a*sqrt(2*r*r-a*a)))-a". s ...
by htl
Sun Jul 06, 2003 5:54 am
Forum: Volume 105 (10500-10599)
Topic: 10500 - Robot maps
Replies: 45
Views: 13857

Then why the first example of the prob is 7?? My prog calculated it as 8... Could someone tell me where I'm wrong??
by htl
Thu Jul 03, 2003 6:59 pm
Forum: C
Topic: Rounding methods
Replies: 6
Views: 2458

Rounding methods

Sometimes there are some prob you can't get AC because of the precision. And rounding is always the key. Could someone share your experiences and methods of rounding?? Thanks a lot!!
by htl
Thu Jul 03, 2003 6:55 pm
Forum: Volume 105 (10500-10599)
Topic: 10509 - R U Kidding Mr. Feynman?
Replies: 41
Views: 13886

I got AC. And you're a great helper! Thanks!
by htl
Thu Jul 03, 2003 9:24 am
Forum: Volume 105 (10500-10599)
Topic: 10517 - Wind of Change!
Replies: 12
Views: 4427

It really works!!

Thanks very much for teaching another method of rounding! :D
by htl
Thu Jul 03, 2003 9:20 am
Forum: Volume 105 (10500-10599)
Topic: 10509 - R U Kidding Mr. Feynman?
Replies: 41
Views: 13886

I saw it in other articles that adding 0.0000000001 can improve the precision... I modified the code and still got WA... [c] #include<stdio.h> #include<math.h> void main(void) { long a; double n; while(1) { scanf("%lf",&n); if(n==0) break; a=pow(n,1.0/3.0); printf("%.4lf\n",(n+2*a*a*a)/3/a/a); } } [...
by htl
Wed Jul 02, 2003 6:14 pm
Forum: Volume 105 (10500-10599)
Topic: 10509 - R U Kidding Mr. Feynman?
Replies: 41
Views: 13886

10509

Can someone help me with my code?? I'm really poor at the precision prob. [c] #include<stdio.h> #include<math.h> void main(void) { double n,a; while(1) { scanf("%lf",&n); if(n==0) break; a=ceil(pow(n,1.0/3.0))+0.0000000001; if(a*a*a>n) a--; printf("%.4lf\n",(n+2*a*a*a)/3/a/a); } } [/c]
by htl
Wed Jul 02, 2003 6:04 pm
Forum: Volume 105 (10500-10599)
Topic: 10517 - Wind of Change!
Replies: 12
Views: 4427

10517

I think it's the precision prob. But I'm so confused that how do I get the integer part of a floating-point number. Can someone help me?? [c] #include<stdio.h> #include<math.h> void main(void) { int count,x; double n,m,pi,theta,a,b,angle; pi=2*acos(0); scanf("%d",&count); for(x=1;x<=count;x++) { sca...

Go to advanced search