10519 - !! Really Strange !!

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

Moderator: Board moderators

New poster
Posts: 24
Joined: Sat Mar 22, 2008 5:49 am
Location: Chennai

10519 - RTE

Post by zyxw » Sun Jul 06, 2008 2:48 pm

I'm new to Java..
My code gets RTE.

Is my method of taking input wrong?
Please help :roll:

Code: Select all

cut after AC
Last edited by zyxw on Tue Nov 11, 2008 3:28 pm, edited 1 time in total.
I am not totally useless, because I can still be used as a bad example :P

Experienced poster
Posts: 145
Joined: Thu Aug 14, 2003 8:42 am
Location: Mountain View, California

Re: 10519 - Really Strange

Post by DD » Tue Nov 04, 2008 6:28 pm

dust_cover wrote:can anybuddy tell me what should be the output for inout 0 & 1.....I am getting WA.
I used BigInt library
Also used the standard formula for the problem!

Thanx in advance
To dust_cover:

You should output 1 if input is 0, and 2 if input is 1.

Hope this can help you.
Have you ever...
  • Wanted to work at best companies?
  • Struggled with interview problems that could be solved in 15 minutes?
  • Wished you could study real-world problems?
If so, you need to read Elements of Programming Interviews.

New poster
Posts: 24
Joined: Sat Mar 22, 2008 5:49 am
Location: Chennai

Re: 10519 - Really Strange

Post by zyxw » Tue Nov 11, 2008 3:26 pm

This is REALLY STRANGE :oops:

The code which i posted in my previous post got WA today!
I don't understand how RTE changed to WA..
Anyway after correcting the error, got AC :)
I am not totally useless, because I can still be used as a bad example :P

Learning poster
Posts: 72
Joined: Tue May 30, 2006 5:57 pm
Location: bangladesh

Re: 10519 Very Strange... Key formula...

Post by mak(cse_DU) » Tue Dec 23, 2008 9:33 pm

soyoja wrote:I read previous article that the key formula for solving this problem is

"f(n) = n^2 - n + 2 ".

But I'm very anxious how can generate this formula....

Could anyone explain this principle?
I just count the number of intersection and add 2.
That means F(N)=number_Of_Intersection + 2;

How can we calculate number_Of_Intersection?
Just think that........
Using two circle we can make intersection.......
So select 2 circle from N circle= nC2.
Every two circle make 2 intersection.
so number_Of_Intersection=2 * nC2 .
F(N)=2* N*(N-1)/2 + 2
=>F(N) = N*(N-1)+2
=>F(N) = N*N - N + 2.

Special case:
Help me PLZ!!

User avatar
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

Re: 10519 - Really Strange

Post by plamplam » Fri Dec 09, 2011 8:33 pm

Nice problem but lame description. It took me a lot of time just to understand what the problem-setter was saying. I suggest this problem-setter guy needs to learn how to communicate properly.
Best Regards.
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

User avatar
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 10519 - Really Strange

Post by uDebug » Sat Mar 08, 2014 9:11 am

Here's some input / output that I found useful during testing / debugging.


Code: Select all

AC Output:

Code: Select all

Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

Post Reply

Return to “Volume 105 (10500-10599)”