谢谢乱弹,果然这里能人不少。我觉得最难得是求和。要是有人给个方法更好。我是这样想的: For 100<=x<=999, if I can find all f(x) = k, I will be able to get the sum I think I should find the following www.ddhw.com A. number of 3 digit integers using digits 0, 1, 2, ...., k, where digit 0 and k must be used. Call it N0(k) B. number of 3 digit integers using digits 1, 2, 3, ...., k-1, where digit 1 and k-1 must be used, if (k>1). Call it N1(k) ... C. number of 3 digit integers using digits 9-k, 9-k+1, 9-k+2, ...., 9, where digit 9-k and 9 must be used, if (k!=9). This should be the same as N1(k) For example, N0(1) = 3 (100, 110, 101), N1(1)=6 (121, 122, 112, 212, 211, 221) www.ddhw.com then the solution is sum of k(N0(k)+(9-k)N1(k)) for k=0 to 9. My question: 0. Is this analyse correct? 1. Is there a better way to do this? 2. The above A, B, C are all permutation problems, is there a general terms to get the solutions for N0(k) and N1(k) for k=0, 1, ..., 9? I tried, I couldn't get a good formula My analyses may be wrong above. You are welcomed to point it out. www.ddhw.com
|