ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1385. Interesting Number

Give me answer n=2,3,4 plz....
Posted by Poleshuk_N 23 Dec 2005 20:40
My answer is
n=2 : 140
n=3 : 1400
n=4 : 14000


Edited by author 23.12.2005 20:41
Re: Give me answer n=2,3,4 plz....
Posted by Sandro (USU) 23 Dec 2005 21:09
You can find answer for n=2 yourself with bruteforce solution. And it's not 140. :)

Good luck!
Re: Give me answer n=2,3,4 plz....
Posted by Poleshuk_N 24 Dec 2005 07:39
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
Re: Give me answer n=2,3,4 plz....
Posted by Ilya (Vologda SPU) 7 Nov 2009 22:03
Угу... счас! WA#7!
Хотя моя программа выдаёт те же самые числа до n = 5 включительно, дальше считать не стал, ибо придётся загнать комп до чёрного дыма >___<"
Mathematical proof
Posted by S.77 7 Aug 2011 05:09
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