UVALive 6653 Pattern Locker(组合数学)
来源:互联网 发布:linux查看内存报错 编辑:程序博客网 时间:2024/06/06 20:42
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=48735
题意:计算C(n,l)*l!+C(n,l+1)*(l+1)!.....+C(n,r)*r!.
#include <bits/stdc++.h>using namespace std;typedef long long ll;const int N=105;const ll MOD=10000000000007;int n,l,r;int main() {#ifdef ONLINE_JUDGE#else freopen("test.in", "r", stdin);#endif int ca=1; int T; scanf("%d",&T); while(T--) { scanf("%d%d%d",&n,&l,&r); ll cur=1; ll x=n*n; ll res=0; for(int i=1; i<=r; i++) { cur=(cur*x--)%MOD; if(i>=l) { res=(res+cur)%MOD; } } printf("Case %d: %lld\n",ca++,res); } return 0;}
0 0
- UVALive 6653 Pattern Locker(组合数学)
- UVALive 6926Maximum Score(组合数学)
- Pattern Locker
- UVALive 3720 Highways 组合数学
- UVALive 6844 Combination(组合数学)
- UVA 12712 Pattern Locker(简单排列组合数学题)
- UVA 12712 Pattern Locker(排列的基本应用)
- UVaLIve 2889 | LA 2889 | UVa 12050 - Palindrome Numbers (组合数学)
- UVALive 7040 Color (容斥原理 + 组合数学递推公式 + 求逆元 + 基础数论)
- UVALive 7040 Color (容斥原理 + 组合数学递推公式 + 求逆元 + 基础数论)
- UVALive 6618 Skycity(数学)
- UVALive 6469 Deranged Exams 组合数学+容斥原理
- HDOJ2045(组合数学)
- Combinations(组合数学)
- 组合模式(Composite Pattern)
- 组合模式(Composite Pattern)
- 组合模式(Composite Pattern)
- 组合模式(Composite Pattern)
- Java中的Callable和Future
- 解决浮点数自动取整问题
- HDOJ 1877 又一版 A+B(进制转换,水)
- Oracle 分区表相关信息
- hdu 1251 简单字典树
- UVALive 6653 Pattern Locker(组合数学)
- Cascade Adaboost级联分类器的训练
- Flume前述(二)--功能配置
- 网易2016两道题Assuming Digits && Best Compression Algorithms
- 趣吃饭相关 资料
- 核心动画1、(初解)
- java设计模式学习笔记---适配器
- 关键字(linux 、系统调用、open、umask、文件权限) blog.sina.com.cn/s/blog_695a54a00100ni93.html
- OSSIM