11185 - Ternary

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

Moderator: Board moderators

User avatar
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 11185 - Ternary

Post by uDebug » Fri Mar 21, 2014 12:07 pm

Here's some input / output I found useful during testing / debugging.

Input:

Code: Select all

00000
2823892
9230230
1000000000
-5789
AC Output:

Code: Select all

0
12022110122121
122100221111101
2120200200021010001
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

moudud99
New poster
Posts: 28
Joined: Fri Feb 08, 2013 1:40 pm

Re: 11185 - Ternary

Post by moudud99 » Wed Jul 09, 2014 1:56 pm

can anyone please help me to find problem with this code?

Code: Select all

not so hard but....also not easy!!
Last edited by moudud99 on Mon Dec 08, 2014 8:34 am, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11185 - Ternary

Post by brianfry713 » Wed Jul 09, 2014 9:25 pm

Input:

Code: Select all

10
1
-1
AC output:

Code: Select all

101
1
Check input and AC output for thousands of problems on uDebug!

moudud99
New poster
Posts: 28
Joined: Fri Feb 08, 2013 1:40 pm

Re: 11185 - Ternary

Post by moudud99 » Thu Nov 27, 2014 2:18 pm

please help me now.I modified my code.

Code: Select all

Mind it on "always print newline after testcase"
Last edited by moudud99 on Mon Dec 08, 2014 8:35 am, edited 1 time in total.

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11185 - Ternary

Post by lighted » Thu Nov 27, 2014 4:27 pm

Always print newline after last line. You should set '/0' at the end of string before printing.

Code: Select all

    ..
    for (int i = 0; i < n; i++) s[i] = s1[i];
    s[n] = 0;
}
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

Post Reply

Return to “Volume 111 (11100-11199)”