438 - The Circumference of the Circle

All about problems in Volume 4. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

RC's
Learning poster
Posts: 65
Joined: Fri Jul 13, 2007 3:17 pm

Re: 438 - The Circumference of the Circle

Post by RC's »

of course i define PI as what the problem states :
Here is my code, i don't know what's wrong... it makes me really confused..

Code: Select all

CUT... AC already
Last edited by RC's on Sun Apr 06, 2008 6:07 pm, edited 1 time in total.
Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 438 - The Circumference of the Circle

Post by Obaida »

You Made a bad mistake,
What about "long double and scanf("%lf.....)
I think it should be scanf("%Lf......)
Remove your code after Ac...
try_try_try_try_&&&_try@try.com
This may be the address of success.
RC's
Learning poster
Posts: 65
Joined: Fri Jul 13, 2007 3:17 pm

Re: 438 - The Circumference of the Circle

Post by RC's »

ic2.. you are right, it was my mistake... but when i ran it on MSVC it produced right answers.. i don't know if gcc doesn't...
it's compiler issue i think.. by the way, thanks..
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Re: 438 - The Circumference of the Circle

Post by Jan »

I don't know which version of MSVC you are using. I use MSVC 6.0 which doesn't support (the actual!!) 'long double'. You can use 'long double' though. But it acts as ordinary 'double'. So, '%lf' works for both 'double' and 'long double' in MSVC 6.0 (since both are same here).
Ami ekhono shopno dekhi...
HomePage
RC's
Learning poster
Posts: 65
Joined: Fri Jul 13, 2007 3:17 pm

Re: 438 - The Circumference of the Circle

Post by RC's »

I use MSVC 9.0 Express Edition... When I debug here, it produced correct answers, just the same answers as I used %lf for the input...
But i don't know why when I changed %lf to %Lf it got AC.. I didn't change any other code..
blackSajia
New poster
Posts: 4
Joined: Tue Nov 11, 2008 12:14 pm

Re: 438 - The Circumference of the Circle

Post by blackSajia »

Hello How r u everybody. I am getting wrong answer in 438. The code given bellow :

Code: Select all



Plz help me where the error occured and give some I/O data. :lol:
Last edited by blackSajia on Sat Nov 15, 2008 11:01 am, edited 1 time in total.
Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Re: 438 - The Circumference of the Circle

Post by Obaida »

you should use long double. :D
try_try_try_try_&&&_try@try.com
This may be the address of success.
lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 438 - The Circumference of the Circle

Post by lnr »

Is there any condition for a point to be on the circle?
I am trying to solve this problem using this equation.
x*x+y*y+2*f*x+2*g*y+c=0;
arifcsecu
Learning poster
Posts: 64
Joined: Fri Sep 25, 2009 11:29 am
Location: Chittagong,University of chittagong
Contact:

Re: 438 - The Circumference of the Circle

Post by arifcsecu »

i got 11 times WA using x^2+y^2+gx+fy+c=0 equation method.
At last i got accepted using Sunny methods.

Thanks Sunny Bhi..
Try to catch fish rather than asking for some fishes.
avatar
New poster
Posts: 8
Joined: Wed Nov 16, 2011 6:44 pm

Re: 438 - The Circumference of the Circle

Post by avatar »

i was trying to use the following algorithm but it gave me WA:
1.i considered the given three points to be the vertex of a triangle
2.then i found the centroid
3.so actually that is the center of the circle surrounding the triangle
4.then from the centroid i found distance of any vertex which is actually the radius
5.then i applied the formula for circumference

another thing i could not use long double :oops:
if i use it answer is always -2.0000000
but why?????????


can anyone have the idea please.................... :roll:
alimbubt
New poster
Posts: 39
Joined: Tue Aug 07, 2012 10:40 pm
Location: BUBT,Dhaka, Bangladesh
Contact:

Re: 438 - The Circumference of the Circle

Post by alimbubt »

Input:

Code: Select all

-1.0 -1.0 -1.0 7.0 5.0 12.0
0.0 -50.0 50.0 50.0 0.0 0.0
2.0 56.0 41.0 28.0 23.0 91.0
Output:

Code: Select all

58.55
496.73
206.54
Give me six hours to chop down a tree and I will spend the first four sharpening the axe...(BUBT ILLUSION)
http://uhunt.felix-halim.net/id/155497
http://onlyprogramming.wordpress.com/
triplemzim
New poster
Posts: 48
Joined: Sat Apr 06, 2013 6:02 pm

Re: 438 - The Circumference of the Circle

Post by triplemzim »

Here is my code... I got 7 times wa why?? Plz help.

Code: Select all

ACCEPTED

thanks brianfry.... :)
Last edited by triplemzim on Fri Jul 26, 2013 12:15 am, edited 1 time in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 438 - The Circumference of the Circle

Post by brianfry713 »

Print a newline after each value.
Check input and AC output for thousands of problems on uDebug!
triplemzim
New poster
Posts: 48
Joined: Sat Apr 06, 2013 6:02 pm

Re: 438 - The Circumference of the Circle

Post by triplemzim »

brianfry713 wrote:Print a newline after each value.
thanks brianfry... got ac
Savage COOKS
New poster
Posts: 1
Joined: Wed Feb 10, 2016 2:44 am

Re: 438 - The Circumference of the Circle

Post by Savage COOKS »

Hey everyone, first post ever here. Problem 438 seemed pretty straight forward with no crazy cases. The program was run with critical input, and any other input that could be thought of from the debug page. Everything comes back correct. An <<endl was put at the end of each printout, to make sure there was line break between numbers. An extra <<endl was added here or there to try to see if more line breaks were needed, all resulting in WA. Once again, the numerics do match all the data that has been plugged into the debugger. Anyone care to shed some light on this program? I am hoping it is something stupidly silly.

Code: Select all

I think it is fixed now...
Thanks!
Post Reply

Return to “Volume 4 (400-499)”