|
+40
Numbers which will increase x are from 2 to 9 in which prime numbers are 2,3,5,7. So x will eventually turn into x*( 2^a * 3^b * 5^c * 7^d ) after some number of operations. As we all know 2^63, 3^39, 5^27, 7^22 are all close to 10^19. So 64 * 40 * 28 * 23 = 1648640 are the number of different numbers that can be made. In this I have considered all the numbers which can be made using these combinations of prime to the power of some number. Which will not be the case in the real brute force implementation. It will close out at about 1e5 or so. There's your proof. |
|
+26
Solution for F. There are no good explanation in the comments. Also some of the wrong solution are getting accepted with some heuristics link . So I thought I would explain how I did it after 3 hours of struggling. And if anyone can counter my solution you are welcome. I will try to explain form the basics. Let us first see the representation For a single String i Let an For String i For example If the final string formed after rearranging is Then make two sets of First set containing Second set containing the remaining elements that is Sort Append the second set at the back of the first set Initial let us denote the difference of Subtract check if add If finally Now why this works ?? I'm not sorting according to some difference of value of Explanation. 1 ) As you can see in the sorting order of 2 ) The second part is not that intuitive like why to sort 3) The |
|
0
It stands for binary search. Well he has made complete function but there is no need c++ stl for vectors provides you with upper_bound lower_bound and binary_search options google it. Also it will be best to the learn the main algorithm. |