Page **1** of **3**

### 10700 - Camel trading

Posted: **Fri Aug 27, 2004 6:01 pm**

by **Eduard**

Sorry for putting this topic in volume CVI but at thismoment ther is not Volume CVII.

I don't know why i'm geting WA.My solution is good solution I use DP and get right answers for simple input.

I saw that nobody at this moment have got this problem AC by Pascal.

Whats wrong.

Posted: **Fri Aug 27, 2004 8:36 pm**

by **little joey**

Well, I just got accepted in Pascal (with my alter ego account xenon, else it wouldn't show up in the list

), so there shouln't be any problem.

You can use DP, but, as Per stated somewhere, there also is a greedy approach which is a lot faster. And like him, I'm also not 100% convinced that it works for all special cases. But hey, AC is AC.

Posted: **Fri Aug 27, 2004 8:38 pm**

by **liulike**

My solution is as follw:

define the operator preority by yourself.

If you want to get the max , the *'s preority should be greater than +

also, If you want to get the min , the +'s preority should be greater than *

After that, you should only calculte the expression's value.

Posted: **Fri Aug 27, 2004 9:16 pm**

by **Eduard**

Hello little joey If you got AC by Pascal then tell me please did you use Longint or something else int64,qword..?

Posted: **Fri Aug 27, 2004 10:04 pm**

by **little joey**

I use int64 since 20*20*20*20*20*20*20*20*20*20*20*20 > 2^31.

### Pascal.

Posted: **Mon Aug 30, 2004 7:01 am**

by **_.B._**

Greetings all!

I solved this one in Pascal too.

I used QWord.

I made it in a pretty mechanical way

A couple of arrays of strings, and such.

Got time 0:00.598, but ACed

Keep posting!

### 10700 WA

Posted: **Mon Aug 30, 2004 12:24 pm**

by **Minilek**

AC

### Re: problem with 10700

Posted: **Mon Aug 30, 2004 1:03 pm**

by **Examiner**

Eduard wrote:I don't know why i'm geting WA.My solution is good solution I use DP and get right answers for simple input.

I saw that nobody at this moment have got this problem AC by Pascal.

Whats wrong.

Did you define infinity correctly? That was my problem.

Posted: **Mon Aug 30, 2004 2:03 pm**

by **Minilek**

EDIT:

Don't be dumb like me. In calculating how big your char array should be for holding the expression, remember that numbers can be 2 digits

[c]

AC

[/c]

Posted: **Mon Aug 30, 2004 6:03 pm**

by **Minilek**

[c]

AC

[/c]

EDIT:

To anyone else who may have the same stupid problem I did. The string I used to hold the expression was a char array of size 24 (at most 12 numbers, at most 11 operators, plus the '\0'). However, I forgot that some numbers could be 2 digits, which means the array size should have been at least 36

Posted: **Thu Sep 02, 2004 2:29 pm**

by **wolf**

I got AC by c++

If it help someone I can say that the double is the right type of data for this problem

Posted: **Thu Sep 02, 2004 4:14 pm**

by **Eduard**

Examiner was right i made the infinity wrong because i write it for longint and infinity=maxlongint.Now I chang infinity=5*10^15 and got AC.

Posted: **Sun Sep 12, 2004 5:03 pm**

by **Junayeed**

To Eduard,

Why do I need 'infinity'. Please explain.

And what is the output for the following input

20*20*20*20

160000 and 0.(Max and min)

Thanks.

Posted: **Sun Sep 12, 2004 6:53 pm**

by **Junayeed**

I think my output was wrong. I think the output will be like this :

160000 and 160000.(Max and min).

Is it ok.

Thanks

Posted: **Mon Sep 13, 2004 2:27 pm**

by **Junayeed**

My previous output was right.

I got AC now.

Thanks