codeforces 1091D. New Year and the Permutation Concatenation 打表

題意:輸入一個數 n(1,1000000),n 的全排列組成的集合 A,長度爲 n*n!,在集合 A 中,輸出全部長度爲 n 的子集中數字和爲 n*(n+1)/2 的子集個數。ios 思路:用 dfs 打表找規律,發現 ans[n] = n! + ans[n-1]*n。c++ AC代碼:spa #include<bits/stdc++.h> using namespace std; #define
相關文章
相關標籤/搜索