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 1009. K-based Numbers

HELP!!! Why my algo is wrong???
Posted by Alexander (201 - P TNU) 23 Dec 2007 15:27
help me, i can't find error in my algo.

for (n = 3, k = 10)
we have 1 case
x00, where x can take (k-1) digits
(anyway first digit can take k - 1)
so answer is 9*10^2 - 9 = 891  - right!

for (n = 4, k = 10)
we have 2 cases:
x00y  - y can take k digits - 9*10
xx00  - 9*9
answer  - 9*10^3 - 90 - 81 = 8829 - right

for(n = 5, k = 10)
we have 3 cases
x00yy (9*10^2)
xx00y (9^2*10)
xxx00 (9^3)
we have 87561, but right answer is 87480

Edited by author 23.12.2007 15:29
Re: HELP!!! Why my algo is wrong???
Posted by AndreyM 28 Sep 2008 00:14
for(n = 5,k = 10)
You are wrong

Right answer
x00yy(9*10^2)
xx00y(9^2*10)
xyx00(9^2*10) //!!!xYx00
87480