10854 - Number of Paths

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

Moderator: Board moderators

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf » Sat Jun 04, 2005 11:50 pm

Oops, sorry.
Then try these inputs instead. They're correct, I suppose.

Code: Select all

2
IF
IF
ELSE
END_IF
IF
ELSE
END_IF
ELSE
END_IF
ENDPROGRAM
IF
ELSE
IF
ELSE
END_IF
IF
ELSE
END_IF
END_IF
ENDPROGRAM
Outputs: 5, 5.

zhang
New poster
Posts: 11
Joined: Sun May 22, 2005 11:14 am

Post by zhang » Sun Jun 05, 2005 7:26 am

Thank u for your test data. I found a mistake and got AC.

Raiyan Kamal
Experienced poster
Posts: 106
Joined: Thu Jan 29, 2004 12:07 pm
Location: Bangladesh
Contact:

Post by Raiyan Kamal » Sun Jul 31, 2005 3:02 pm

Thanks to mf for the test cases.

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski » Tue Nov 22, 2005 6:12 pm

Problem seems to be easy ...
I got correct output for every case in this board (and sample IO too ;) ) but I got WA, when I send it.

Could anyone help me? I can't see my mistake :(
Basically (I can send code, if someone requests for it) my algorithm is:
count all leafs on tree created from if-else-end_if statements. Multiply results from each separate if-else-end_if statement occured on root level of program (level of endprogram keyword).

I cover all cases with multiply number of if statements in row on any deep in tree.
Maybe someone post tricky case I missed?

Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski » Thu Nov 24, 2005 9:18 pm

I'm so stupid :(
I make silly mistake, I got Accepted now.

Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

hoang
New poster
Posts: 4
Joined: Sat Jan 14, 2006 6:02 pm

WA again ?

Post by hoang » Sat Jan 14, 2006 6:07 pm

Code: Select all

1
IF
ELSE
IF
ELSE
IF
END_IF
END_IF
IF
END_IF
IF
ELSE
END_IF
END_IF
ENDPROGRAM
i got WA again. and plz see that test.
2 of my friend got accept but 1 have answer is 5 and another have 12 ( me 9 )

i dont know what is the right answer ?

mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf » Sat Jan 14, 2006 7:00 pm

That's not a correct input. Every IF must have an ELSE.

hoang
New poster
Posts: 4
Joined: Sat Jan 14, 2006 6:02 pm

sorry

Post by hoang » Tue Jan 17, 2006 2:20 pm

Code: Select all

1
IF
ELSE
IF
ELSE
IF
END_IF
END_IF
IF
END_IF
IF
ELSE
END_IF
END_IF
END_IF
ENDPROGRAM
i think the result is 5 .

User avatar
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Re: sorry

Post by Martin Macko » Sun May 21, 2006 1:21 am

hoang wrote:i think the result is 5 .
This input is not correct, too. The IF and END_IF statements must be ballanced.

solon_aguiar
New poster
Posts: 7
Joined: Mon Jun 08, 2009 11:16 pm

Re: 10854 - Number of Paths

Post by solon_aguiar » Wed Feb 17, 2016 1:26 am

Does anybody have other valuable inputs? My code passes all the inputs in this topic, but still getting WA.

solon_aguiar
New poster
Posts: 7
Joined: Mon Jun 08, 2009 11:16 pm

Re: 10854 - Number of Paths

Post by solon_aguiar » Wed Feb 17, 2016 4:55 am

Got it accepted. The following case was helpful in debugging:

Code: Select all

1
IF
ELSE
END_IF
S
S
S
IF
ELSE
IF
ELSE
END_IF
IF
ELSE
END_IF
S
S
S
S
S
IF
ELSE
END_IF
END_IF
ENDPROGRAM
Output is

Code: Select all

18

Post Reply

Return to “Volume 108 (10800-10899)”