## 1200 - A DP Problem

Moderator: Board moderators

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

### 1200 - A DP Problem

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

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

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

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

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

That should obviously be 3.
Check input and AC output for thousands of problems on uDebug!

Experienced poster
Posts: 122
Joined: Tue Apr 16, 2002 10:07 am

### Re: UVA 1200 clarification

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``````

Experienced poster
Posts: 122
Joined: Tue Apr 16, 2002 10:07 am

### Re: 1200 - A DP Problem

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

Input:

Code: Select all

``````1
2x=0-3
``````
Output:

Code: Select all

``-2``