1200 - A DP Problem

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

Moderator: Board moderators

Post Reply
jg_iut
New poster
Posts: 2
Joined: Thu Dec 29, 2011 12:28 pm

1200 - A DP Problem

Post by jg_iut »

I can't exactly understand when the solution will be IDENTITY and when it will be IMPOSSIBLE........
Can anyone help???
jg_iut
New poster
Posts: 2
Joined: Thu Dec 29, 2011 12:28 pm

Re: UVA 1200 clarification

Post by jg_iut »

All right , I've understood what's the difference.
magurmach
New poster
Posts: 26
Joined: Mon May 14, 2012 8:19 pm

Re: UVA 1200 clarification

Post by magurmach »

If getting WA and don't understand what wrong... then pay attention to line
If s is the solution to the equation, the output line should contain s (the ``floor" of s, i.e., the largest integer number less than or equal to s).
So, for negative number... you know what to do...!
magurmach
New poster
Posts: 26
Joined: Mon May 14, 2012 8:19 pm

Re: UVA 1200 clarification

Post by magurmach »

Some test cases:
input:

Code: Select all

10
0x=0
3x=-9
4=4
2+0x=3+0x
2x+3=0
7x-100=2x+200
x-3=3-x
-x-x-x-x=4
-x+x=2
-x+x=0
Output:

Code: Select all

IDENTITY
-3
IDENTITY
IMPOSSIBLE
-2
60
6
-1
IMPOSSIBLE
IDENTITY
hiddenstones
New poster
Posts: 3
Joined: Fri Sep 14, 2012 1:13 pm

Re: UVA 1200 clarification

Post by hiddenstones »

I don't see how he got 6 with this???

Code: Select all

x-3=3-x
Is there any other test case? I have tried my code with so many test cases and found nothing wrong yet. Is there any suggestion? Thanks.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: UVA 1200 clarification

Post by brianfry713 »

That should obviously be 3.
Check input and AC output for thousands of problems on uDebug!
Zyaad Jaunnoo
Experienced poster
Posts: 122
Joined: Tue Apr 16, 2002 10:07 am

Re: UVA 1200 clarification

Post by Zyaad Jaunnoo »

magurmach wrote:Some test cases:
input:

Code: Select all

10
0x=0
3x=-9
4=4
2+0x=3+0x
2x+3=0
7x-100=2x+200
x-3=3-x
-x-x-x-x=4
-x+x=2
-x+x=0
Output:

Code: Select all

IDENTITY
-3
IDENTITY
IMPOSSIBLE
-2
60
6
-1
IMPOSSIBLE
IDENTITY
Following the statement from the problem description:
No unary plus or minus operators are allowed in the expressions.
Are these data correct?

Code: Select all

3x=-9
-x-x-x-x=4
-x+x=2
-x+x=0
Zyaad Jaunnoo
Experienced poster
Posts: 122
Joined: Tue Apr 16, 2002 10:07 am

Re: 1200 - A DP Problem

Post by Zyaad Jaunnoo »

Be careful to output the *floor* of your result.

Input:

Code: Select all

1
2x=0-3
Output:

Code: Select all

-2
Post Reply

Return to “Volume 12 (1200-1299)”