sgu222 分类: sgu 2015-06-12 09:27 24人阅读 评论(0) 收藏
2015-06-12 09:27
357 查看
数学题,ans=C(k,n)2∗k!
#include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> int fact[20] = {1,1,2,6,24,120,720,5040,40320,362880,3628800}; int choice(int m, int n) { return fact /(fact[m]*fact[n-m]); } long long pow2(int x) { return (long long)x*x; } int main() { int n, k; #ifndef ONLINE_JUDGE freopen("sgu222.in","r",stdin); freopen("sgu222.out","w",stdout); #endif std::cin >> n >> k; if(k > n) std::cout << 0 << std::endl; else std::cout << pow2(choice(k,n))*fact[k]; #ifndef ONLINE_JUDGE fclose(stdin); fclose(stdout); #endif return 0; }
相关文章推荐
- 处理Excel,填充空白区域
- OAuth 2.0
- 译文:理解Java中的弱引用
- POJ2104 K-th Number(划分树和主席树代码)
- 关于Android Studio加载第三方jar包无法编译的问题解决。
- 23种设计模式
- Java中线程休眠编程实例
- 在51CTO学院做讲师的感想:边界
- JavaScript中setUTCMilliseconds()方法的使用详解
- auto property synthesis will not synthesize proterty ;it will be implementedby its superclass, use @
- 给学妹改程序
- 矩阵运算函数
- js正则表达式语法
- 用CSS如何实现单行图片与文字垂直居中
- 6-5单独调整通道曲线
- 认识自己——要拒绝
- 直观的几大排序算法理解
- 在Windows XP中对“任务计划”进行疑难解答
- Android之应用开发基础
- 纯CSS实现图片