UVA 11077 Find the Permutations(置换+dp)
来源:互联网 发布:php pear是什么 编辑:程序博客网 时间:2024/05/14 14:04
代码:
#include <map>#include <set>#include <stack>#include <queue>#include <cmath>#include <string>#include <vector>#include <cstdio>#include <cctype>#include <cstring>#include <sstream>#include <cstdlib>#include <iostream>#include <algorithm>#pragma comment(linker,"/STACK:102400000,102400000")using namespace std;#define MAX 10005#define MAXN 1000005#define maxnode 205#define sigma_size 2#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define lrt rt<<1#define rrt rt<<1|1#define middle int m=(r+l)>>1#define LL long long#define ull unsigned long long#define mem(x,v) memset(x,v,sizeof(x))#define lowbit(x) (x&-x)#define pii pair<int,int>#define bits(a) __builtin_popcount(a)#define mk make_pair#define limit 10000//const int prime = 999983;const int INF = 0x3f3f3f3f;const LL INFF = 0x3f3f;//const double pi = acos(-1.0);const double inf = 1e18;const double eps = 1e-9;const LL mod = 1e9+7;const ull mx = 133333331;/*****************************************************/inline void RI(int &x) { char c; while((c=getchar())<'0' || c>'9'); x=c-'0'; while((c=getchar())>='0' && c<='9') x=(x<<3)+(x<<1)+c-'0'; }/*****************************************************/ull dp[25][25];int main(){ //freopen("in.txt","r",stdin); int n,k; while(cin>>n>>k&&n){ mem(dp,0); for(int i=1;i<=n;i++) dp[i][0]=1; for(int i=2;i<=n;i++){ for(int j=1;j<i;j++){ dp[i][j]=dp[i-1][j]+dp[i-1][j-1]*(i-1); } } cout<<dp[n][k]<<endl; } return 0;}
0 0
- UVA 11077 Find the Permutations(置换+dp)
- uva 11077 - Find the Permutations(置换+dp)
- UVA 11077 Find the Permutations(置换+dp)
- UVA Find the Permutations 11077 (DP&置换群)
- UVa 11077 Find the Permutations / 置换
- uva 11077 - Find the Permutations(置换)
- UVA - 11077 Find the Permutations (置换)
- UVA 11077 Find the Permutations(置换)
- UVA 11077 Find the Permutations 置换+递推
- uva 11077 Find the Permutations 置换+递推
- UVA 11077 Find the Permutations DP
- UVa11077-Find the Permutations(dp+置换)
- Find the Permutations [Uva 11077]
- UVA 11077 - Find the Permutations(递推)
- Find the Permutations UVA11077
- uva11077 Find the Permutations
- uva11077 Find the Permutations
- UVA11077 Find the Permutations(排列统计)
- Android性能优化调研——UI布局优化
- Java 内部类与静态类
- 数据库的读写分离
- JAVA-从啼哭开始的征程
- 常用ADB命令整理
- UVA 11077 Find the Permutations(置换+dp)
- Ubuntu下解压文件
- static_cast, dynamic_cast, const_cast探讨
- qt超强精美绘图控件 - QCustomPlot一览 及 安装使用教程
- Java程序猿之IO(25)
- 线段切割&&矩形切割
- 计算机英语词汇总结
- 1050. 螺旋矩阵(25)
- 细思恐极----美国掌握网络世界生杀大权