https://www.codechef.com/viewsolution/35694973
which unique test case is i am failing to test and evaluate.
https://www.codechef.com/viewsolution/35694973
which unique test case is i am failing to test and evaluate.
Help me out
For 3rd sample case , your program outputs YES when it should print NO.
@shuvik_18
in your logic you haven’t considered the case when an alphabet repeats for more than 9 times,
Testcase:
1
aaaaaaaaaabcdefgh
after reducing:
a10b1c1d1e1f1g1h1
length= 17
but your logic says length=16
and please check your code on sample test case before submission
still WA, apologies for previous error, but i have tested now.
@shuvik_18
you should’nt be using the method of counting the frequency as the compressed form of
aabaaa is a2b1a3 and not a5b1, so tou need to give up the current logic. You’ll have to use
a different approach to calculate the frequency.
https://www.codechef.com/viewsolution/35699933
have a look at my solution.
when x= 100
newlength=(100/10)+2=10+2=12
is it so ?
a100 = 4
@ak_singh17 can u explain it with example
@shuvik_18
no actually for a larger number you’ll need to count the number of digits in your frequency count variable.
use while(x>0)
{ new_length++;
x=x/10;}
and remeber this count is just for the number of digits,i.e 3 for 100 but its actually 4 as its a100.
you can have a look at the editorial for more help.