11193 - Infinix
Moderator: Board moderators
11193 - Infinix
I tried solving this one with dynamic programming but I keep getting WA. Does anybode have some tricky test cases?
Yesdomino wrote:If A=S=M=D=1 my program outputs 5. Is it correct?sclo wrote:did you handle cases like these properly?
1+1+1-1-1+1-1-1-1+1+1+1-1-1
Which operations could be done last?
Code: Select all
1 1 1 1
1+1+1-1-1+1-1-1-1+1+1+1-1-1
1 2 1 1
1+1+1-1-1+1-1-1-1+1+1+1-1-1
2 1 1 1
1+1+1-1-1+1-1-1-1+1+1+1-1-1
1 3 1 1
1+1+1-1-1+1-1-1-1+1+1+1-1-1
3 1 1 1
1+1+1-1-1+1-1-1-1+1+1+1-1-1
Code: Select all
5
8
8
11
12
Getting many WA.. Could someone verify my I/O?
Input:
Output:
Thanks in advance.
Input:
Code: Select all
1 1 1 1
1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1
1 1 1 1
1/1/1/1/1/1/1/1/1/1/1
1 2 3 4
1/1*1/1/1*1*1/1*1
2 1 1 2
1+1+(1-(1-(1+1)-(1-1-1)+1+1+1)-1-1)
2 1 4 3
1-2/2*3+4-1*2
2 1 4 3
1+1*1-(1/1/1)*1*1/1+(1-(1+1*1)-1)/1
2 1 4 3
1+1*1*1/1-(1/1/1)+1*1/1+(1+1*1)-1/1+1
0 0 0 0
Code: Select all
5
10
13
11
11
14
13
Last edited by rio on Tue Mar 06, 2007 11:11 am, edited 1 time in total.
I got accepted and my outputs are:
Code: Select all
5
10
14
11
10
14
13
Is there any other special input
My code gives correct output for all the sample given and the input given in this topic.
But still getting WA:(
Any other special inputs.
Will there be empty string as input?
But still getting WA:(
Any other special inputs.
Will there be empty string as input?
[quote="rio"]Getting many WA.. Could someone verify my I/O?
Input:
Output:
[quote]
Could someone explain why ths answer is 14.
Thx anyway
Input:
Code: Select all
1 2 3 4
Code: Select all
14
Could someone explain why ths answer is 14.
Thx anyway
ForCould someone explain why ths answer is 14.
Thx anyway
Code: Select all
1 2 3 4
1/1*1/1/1*1*1/1*1
Here's a way to do it with cost 14:
(((1/1)*((1/1)/1))*(1*((1/1)*1)))
Remember that division can't be the last operation unless there are no multiplications after it.