Page 3 of 3

Re: 11185 - Ternary

Posted: Fri Mar 21, 2014 12:07 pm
by uDebug
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

Re: 11185 - Ternary

Posted: Wed Jul 09, 2014 1:56 pm
by moudud99
can anyone please help me to find problem with this code?

Code: Select all

not so hard but....also not easy!!

Re: 11185 - Ternary

Posted: Wed Jul 09, 2014 9:25 pm
by brianfry713
Input:

Code: Select all

10
1
-1
AC output:

Code: Select all

101
1

Re: 11185 - Ternary

Posted: Thu Nov 27, 2014 2:18 pm
by moudud99
please help me now.I modified my code.

Code: Select all

Mind it on "always print newline after testcase"

Re: 11185 - Ternary

Posted: Thu Nov 27, 2014 4:27 pm
by lighted
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;
}