Awkward submission

hello,i want to know that how these peoples know the answers in advance see this solution.I have no idea how she calculated or get these values.See array mouni of the solution.question link

1 Like

Actually for this problem, pre-calculation is very easy. We need to find the N th term is series 3, 4, 33, 34, 43, 44, 333, 334, 343, 344, 433, 434, 443, 444, 3333, 3334, 3343, 3344â€¦â€¦. and constraint for N is N <= 100. So one can find all the combinations easily.

Generate the series ( first 100 terms ) using brute force ( or some other method ), store the values in a file ( maybe write a program for this ) then copy/put the values is an array and Voila!! we are done. N <= 100 is well below the size limit of submission.

3 Likes

Well itâ€™s easy.

You can precompute the values , store the values in a file and then copy from that file to the array in the code.

Or

Do it manually if you have the time.

1 Like

See this i used simple decimal to binary conversionâ€¦

here 0 maps to 3 and 1 maps to 4!!

My Submission in Python: http://www.codechef.com/viewsolution/6318989

3 Likes

thanksâ€¦

thanks for replyâ€¦but personally i donâ€™t find it efficient or you can say the best wayâ€¦What do you think

WOW man !!! I am impressed, you did a very nice thing, I also should have thought about this. Anyways +1 for sharing this procedure.

1 Like

Lol it took half hour for me to understand this relation!!

i want to give +10.Nice

2 Likes

See my solution guys and tell me howâ€™s this i am newbieâ€¦solution

1 Like

Nice, isnâ€™t it brute force?

Donâ€™t know broâ€¦what this technique calledâ€¦ this was the first thing that came to my mind.

After looking at your solution i am doubtful that are you really a newbie??

Nice Codeâ€¦

thanks for the complement But not as awesome as yours God code_/_

can u pls tell (or) show the c++ code for generating all such numbers uptill 100 by burte force method?

pls helpâ€¦ i am not getting

@shiva_google here is the solution.You asked @mediocoder but i am giving answer i hope you donâ€™t mind bro .Correct me anybody if i am wrong

Thank you bro

i never mind

who ever answers one thing remains the same => GAINING SOME KNOWLEDGE

i think u generated 1000000000 numbers right? but 100 is enough according to the question?anyways this is not a problem at all

and one more doubt, in check function y did u take a copy of x â€¦ temp=x?

1 Like

mediocoderâ€™s solution: http://www.codechef.com/viewsolution/6315810

LOL my code is not at all awesome broâ€¦!! just because i was not able to implement brute-force algorithm so i thought of an alternativeâ€¦

1 Like

@shiva_google for the sake of time pass nothing else.No need of temp