Guys can anyone give any idea about how to solve this dynamically . I think: if n = 1 => 14 if n = 2 => 16 (+1040, 2080) if n > 2 => 17 (+10...080...0) Is not it??? Sorry for my worse English. For example, 1144 and 2288 are interesting too. n = 1 n = 2 n = 3 n = 4 ..... ..... ..... n = 16 i think this tests will be useful for u plz move it up to the easier places ??? Edited by author 18.03.2015 00:12 My answer is n=2 : 140 n=3 : 1400 n=4 : 14000 Edited by author 23.12.2005 20:41 You can find answer for n=2 yourself with bruteforce solution. And it's not 140. :) Good luck! I solve this problem: n=1 -> write(14) n=2 -> write(155) n=3 -> write(1575) n=4 -> write(15750) n=5 -> write(157500) ................. n=m -> write(157500...00) (n-3 zeros) Edited by author 24.12.2005 07:42 Edited by author 24.12.2005 07:43 Угу... счас! WA#7! Хотя моя программа выдаёт те же самые числа до n = 5 включительно, дальше считать не стал, ибо придётся загнать комп до чёрного дыма >___<" Poleshuk_N is right. Try to solve this as a mathematical problem! Here are some ideas for you. Let "m=a*10^n+b". 'a' divides 'm', hence 'a' divides "b=m-a*10^n", too. Let "b=k*a", where 'k' is a natural number (it cannot be zero as 'b' cannot be zero). Moreover, "k<10" (obvious). On the other hand, 'b' divides 'm', hence 'b' divides "a*10^n=m-b", too. This means that "(a*10^n)/b=(a*10^n)/(k*a)=(10^n)/k" is integer. Thus 'k' is a divisor of '10^n': 1,2,4,5 or 8. But don't forget two special cases: 1) if "n=1", 'k' may be one of: 1,2,5; 2) if "n=2", 'k' may be one of: 1,2,4,5. Then you can perform some simple calculations and find out the answer. Edited by author 07.08.2011 05:12 What is "without leading zeroes"? this means that if the answer is 12, the you should print 12, not 0012; the latter will be judged as Wrong Answer. No, that is not what is meant. It means that an interesting number should not have leading zeros. So "0408" is not an interesting number, even though 408 is divisible by both 4 and 8. 4 is't divisible to 14.. can someone explain my mistake? maybe i dont understand condition. :(( 14 is just a number of numbers (xD): 11, 12, 15, 22, 24, 33, 36, 44, 48, 55, 66, 77, 88, 99. oh thanks :D becouse my bad english sometimes i understood conditions mistakely :( p.s thank you anyway :)) Can anyone suggest a genuine method of solving this problem. i.e. not a method such as if(n==1) printf("14"); else if(n==2) printf("155"); else { printf("1575"); for(i=3;i<n;i++) printf("0"); } Edited by author 24.07.2008 12:02 Edited by author 24.07.2008 12:02 I have solution ... right solution, but I have TLE #4 ... It's so slowly. Yes,this problem has genuine algo: this is just a formula. Try to get it by yourself using this hint: write general formula for interesting numbers on paper and try to find what numbers are impossible and vise-versa. If you want see my code send me mail to bauracm@mail.ru is the number 1001 interesting or not??? I think yes (1001 mod 1 = 0 :) Why not? Definetly NOT! 1001%10 != 0 !!!!! Sorry :) I am not very attentive :( kto reshil etu problemu poshlite i mne please farhof.kenjaev@gmail.com |
|