| 设为首页 加入收藏 |
当前位置: |
| TOP | ||||||||||||||||
|
poj1351Number of Locks(记忆化搜索)
Description In certain factory a kind of spring locks is manufactured. There are n slots (1 < n < 17, n is a natural number.) for each lock. The height of each slot may be any one of the 4 values in{1,2,3,4}( neglect unit ). Among the slots of a lock there are at least one pair of neighboring slots with their difference of height equal to 3 and also there are at least 3 different height values of the slots for a lock. If a batch of locks is manufactured by taking all over the 4 values for slot height and meet the two limitations above, find the number of the locks produced.Input There is one given data n (number of slots) on every line. At the end of all the input data is -1, which means the end of input.Output According to the input data, count the number of locks. Each output occupies one line. Its fore part is a repetition of the input data and then followed by a colon and a space. The last part of it is the number of the locks counted.Sample Input 2 3 -1 Sample Output 2: 0 3: 8 Source Xi'an 2002代码:
|
||||||||||||||||
| 【大 中 小】【打印】 【繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部】 | |
|
分享到:
|
|
| 上一篇:CF #261 div2 D. Pashmak and Par.. | 下一篇:Live555分析(一):VS2008编译 |
| 评论 |
|
|