2985:數字組合
阿新 • • 發佈:2017-07-02
style 01背包 tle clu ams 不同 ram using space
2985:數字組合
- 查看
- 提交
- 統計
- 提問
- 總時間限制:
- 1000ms
- 內存限制:
- 65536kB
- 描述
- 有n個正整數,找出其中和為t(t也是正整數)的可能的組合方式。如:
n=5,5個數分別為1,2,3,4,5,t=5;
那麽可能的組合有5=1+4和5=2+3和5=5三種組合方式。 - 輸入
- 輸入的第一行是兩個正整數n和t,用空格隔開,其中1<=n<=20,表示正整數的個數,t為要求的和(1<=t<=1000)
接下來的一行是n個正整數,用空格隔開。 - 輸出
- 和為t的不同的組合方式的數目。
- 樣例輸入
-
5 5 1 2 3 4 5
- 樣例輸出
-
3
關鍵字:01背包,逆序1 //*************************************
2985:數字組合