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

alt text

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… :slight_smile: :slight_smile: 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… :slight_smile:

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

@mediocoder:

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 :frowning:

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

@emin3m:

Thank you bro :slight_smile:

i never mind :slight_smile:

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 :slight_smile:

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… :stuck_out_tongue:

1 Like

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