|
|
Who can helpme with some hint about this problem? Any right answers, any tests... I've got WA:9, and I can't find mistake 5->4 6->4 7->4 8->4 9->4 10->8 11->8 12~19->6 20~39->11 40->99->31 100~119->71 120~199->51 200~399->101 400~999->301 and so on......i use this rule and got AC. maybe it is a bad methodology...... Edited by author 18.04.2004 19:35 Why the answer is 4 when n is from 5 to 9? to breeze: thanks... you tests very helped me... But if input: 1000 - 701? 1100 - 701? 1200 - 501? 1300 - 501? 2000 - 1001? 4000 - 3001? I have WA#11 [deleted] Edited by author 25.10.2007 17:59 why the answer to n=40 is 31? Because range 1..5 has each lamp in ON and OFF states, and it appears to be the smallest range for all 5<=N<=9 My solution is checking all A..B ranges for the 1st digit. If B-A>1, then I set it as A999999999 till B00000000. If B-A=1, then I try all ranges for the 2nd digit. It appears that no more recursion is necessary, so the answer will be minimal among all BD000000... - AC9999... where A..B covers all lamp states for the 1st digit (consider their existence too and treat zero as all-off) and 0..C together with D..9 covers all lamp states for the 2nd digit. many thanks An niong ha se yo! Here's the explanation: In order to check which lamps in the elevator are bad, you need to watch it CONTINUOUSLY from some level to some other level. You are to minimize the difference between the two levels. Take the sample for instance -- there are 10 levels in all, and at least you have to start from Floor 2 to Floor 10. So the answer 10-2=8 (not 9) levels. Thanks, but could you tell me why we have to start from floor 2 to floor 10? Edited by author 30.10.2004 09:48 |
|
|