Moderator: Board moderators

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

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.
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm
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.

liulike
Learning poster
Posts: 52
Joined: Wed Jul 30, 2003 10:56 am
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.

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan
Hello little joey If you got AC by Pascal then tell me please did you use Longint or something else int64,qword..?
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm
I use int64 since 20*20*20*20*20*20*20*20*20*20*20*20 > 2^31.

_.B._
Experienced poster
Posts: 160
Joined: Sat Feb 07, 2004 7:50 pm
Location: Venezuela
Contact:

### Pascal.

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!
_.

Minilek
Learning poster
Posts: 90
Joined: Tue Jul 27, 2004 9:34 am
Location: Cambridge, MA
Contact:

### 10700 WA

AC
Last edited by Minilek on Mon Aug 30, 2004 6:09 pm, edited 1 time in total.

Examiner
New poster
Posts: 28
Joined: Thu Feb 19, 2004 1:19 pm

### Re: problem with 10700

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.

Minilek
Learning poster
Posts: 90
Joined: Tue Jul 27, 2004 9:34 am
Location: Cambridge, MA
Contact:
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]

Minilek
Learning poster
Posts: 90
Joined: Tue Jul 27, 2004 9:34 am
Location: Cambridge, MA
Contact:
[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

wolf
New poster
Posts: 34
Joined: Sun Aug 22, 2004 4:20 am
Location: Poland
I got AC by c++

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

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan
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.
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

Junayeed
New poster
Posts: 50
Joined: Sat Oct 26, 2002 9:02 am
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.
Junayeed

Junayeed
New poster
Posts: 50
Joined: Sat Oct 26, 2002 9:02 am
I think my output was wrong. I think the output will be like this :

160000 and 160000.(Max and min).

Is it ok.

Thanks
Junayeed

Junayeed
New poster
Posts: 50
Joined: Sat Oct 26, 2002 9:02 am