c++ - Find total number of 1s -


given number n, find total number of 1s present in pow(11, n) 1 < n < 1000,000. solving using basic approach land overflow issues since n large. ways can solve efficiently?

see calculate count of ones in result of 11^n

multiplication 11 equal multiplication 10 (i.e. putting 0 right of number) , adding original number. using can work strings, , don't need additional library.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -