また再帰探索がいけないアルゴリズム問

組み合わせ数学の問題を普通な離散検索で解けませんでした。動的計画法の視点で考えればいいと思ったけど道が発想しません。正解が動的計画法でしたが実施が少し以外な事でした。The dynamic programming map is a 3-dimensional collection of long long integers (64-bit), indexed by a bitmap tracking the first 10 numbers' usage (map), an index of the current index of card being checked (card), and a counter for the number of distinct numbers in use (num). The complexity of iterating over such a table is O(1024*50*60)=3072400. Each recursive call to the table population function has two possible branches: call on (map,card+1,num) without applying the current card, and call on (newmap, card+1,newnum) after applying the current card.
この回答をトップコーダーのホームページでholomorphさんの作品として見つけました。