HDU 4535
裸 的错排。。。。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define LL __int64
using namespace std;
const LL MOD=;
LL cuo[]; void Init(){
cuo[]=; cuo[]=;
for(int i=;i<;i++){
cuo[i]=((i-)*(cuo[i-]+cuo[i-]))%MOD;
}
} int main(){
Init();
int T,n;
scanf("%d",&T);
while(T--){
scanf("%d",&n);
printf("%I64d\n",cuo[n]);
}
return ;
}
HDU 4535的更多相关文章
- hdu 4535 吉哥系列故事——礼尚往来
http://acm.hdu.edu.cn/showproblem.php?pid=4535 错排公式:a[i]=(i-1)*(a[i-2]+a[i-1]): #include <cstdio& ...
- hdu 4535 错排
题意:错排 链接:点我 百年难得一遇大水题 #include<cstdio> #include<iostream> #include<algorithm> #inc ...
- hdu 4535(排列组合之错排公式)
吉哥系列故事——礼尚往来 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Tota ...
- HDU - 4535 ZZULI 1867: 礼上往来【错位排序】
1867: 礼上往来 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 216 Solved: 65 SubmitStatusWeb Board Desc ...
- HDU 4535 吉哥系列故事——礼尚往来( 错排水题 )
链接:传送门 思路:错排模板题,水题是非常浪费时间的. /*********************************************************************** ...
- 4535 ACM 礼尚往来 数学排列组合
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4535 题意:每个礼物都不相同的组合个数 数学规律: 将每个女友排序为1···n,对应的女友送男友的礼物排序 ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
随机推荐
- JS页面刷新保持数据不丢失
转自:https://blog.csdn.net/qq_32439101/article/details/78134877 下面是 DOM Storage 的接口定义: interface Stora ...
- Python入门 不必自己造轮子
操作list list切片 字符串的分割 字符串的索引和切片 读文件 f = file('data.txt') data = f.read() print data f.close() 写文件 dat ...
- Sequence(优先队列)
http://poj.org/problem?id=2442 题意:给你n*m的矩阵,然后每行取一个元素,组成一个包含n个元素的序列,一共有n^m种序列, 让你求出序列和最小的前n个序列的序列和. # ...
- 认识JS的基础对象,定义对象的方法
JS的基础对象: 1.window //窗口对象 2.document //文档对象 3.document.documentElement //html对象 4.docume ...
- Elasticsearch 7.1.1 集群 + 配置身份验证
一.安装Elasticsearch 1.1 环境说明 Centos7.6 Elasticsearch7.1.1 #挂载数据盘 fdisk /dev/vdb n,p,,回车,回车,wq fdisk -l ...
- xx网络--工具集合
-- D:\workspace\bajie_projram\BJ.srfcb\BJ.srfcb\BJ.srfcb 8jielicai_New\App_Code\common\pg.cs---GetHt ...
- POJ 1082---->一个神一般的题
代码只有10行,反正我是看了题解才知道的. 嗯 首先 看到这个题, BFS+一堆判断(什么平年闰年跨年各种乱搞肯定能搞出来,但是Code length就不一定了)... 然后呢 就看到了这个题解 从后 ...
- 遍历WPF DataGrid单元格
using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Media; ...
- Java中Ajaxa中文乱码问题
客户端: url='test/queryList?itemName='+itemName; //如果只转一次url=encodeURI(toUrl); 到后台时:乱码 servlet里dec ...
- ios -使用NSLayoutConstraint实现多个view等宽等高等间距
@interface ViewController () { UIView *firstView; UIView *secondView; UIView *thirdView; } @end @imp ...