hdu 6825 Set1
题目
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6825
思路
这个大佬说的很清楚->大佬博客
再添加以下基础
代码
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<ctime>
#include<iostream>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
#include<fstream>
#include<complex>
#include<algorithm>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define int long long
using namespace std;
const int mod = 998244353;
const int N=5e6+5;
int a[N],ans[N],inv_a[N],inv[N],C_tmp[N],A_tmp[N];
int quick_pow(int a,int b){int res=1;while(b){if(b&1) res=res*a%mod;b>>=1;a=a*a%mod;}return res;
}
int C(int m,int n){return a[m]*inv_a[m-n]%mod*inv_a[n]%mod;
}
int A(int m,int n){return a[m]*inv_a[m-n]%mod;
}
signed main(){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);int t;cin>>t;a[0]=1;for(int i=1;i<=N;i++){a[i]=(a[i-1]*i)%mod;//n! }
// cout<<1<<endl;inv_a[N]=quick_pow(a[N],mod-2);for(int i=N-1;i>=0;i--){inv_a[i]=inv_a[i+1]*(i+1)%mod;//n!的逆元 }
// cout<<2<<endl;for(int i=1;i<=N;i++){inv[i]=inv_a[i]*a[i-1]%mod;//单个n的逆元 }
// cout<<3<<endl;C_tmp[0]=1;for(int i=1;i<=2500000;i++){C_tmp[i]=C_tmp[i-1]*C(2*i,2)%mod;}
// cout<<4<<endl;A_tmp[1]=1;for(int i=3;i<=5000000;i+=2){A_tmp[i]=A_tmp[i-2]*(i-1)%mod;}
// cout<<5<<endl;A_tmp[5000000-1]=quick_pow(A_tmp[5000000-1],mod-2);for(int i=5000000-3;i>=0;i-=2){A_tmp[i]=A_tmp[i+2]*(i+1)%mod;}
// cout<<6<<endl;while(t--){// cout<<7<<endl;int n;cin>>n;for(int i=1;i<=n/2;i++) cout<<"0 ";for(int i=n/2+1;i<=n;i++){int s2=n-i,s1=i-1;cout<<C(s1,s2)*A(s2,s2)%mod*C_tmp[(s1-s2)/2]%mod*inv_a[(s1-s2)/2]%mod*A_tmp[n]%mod<<" \n"[i==n];}}return 0;
}
hdu 6825 Set1相关推荐
- HDU 4389 - X mod f(x)
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=4389 2012多校,第9场,1010 . 问题是,询问区间内 存在多少个 哈沙德数(Harshad ...
- hdu 4389 囧,打表
http://acm.hdu.edu.cn/showproblem.php?pid=4389 题意 :一个数能被他各个位数之和整除则符合要求,给L,R,问区间里有多少个数符合要求. 囧,居然打表就能过 ...
- HDU——1106排序(istringstream的使用、STLvector练习)
排序 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submiss ...
- hdu 5438 Ponds 拓扑排序
Ponds Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/contests/contest_showproblem ...
- HDU 1248 寒冰王座(全然背包:入门题)
HDU 1248 寒冰王座(全然背包:入门题) http://acm.hdu.edu.cn/showproblem.php?pid=1248 题意: 不死族的巫妖王发工资拉,死亡骑士拿到一张N元的钞票 ...
- hdu 1312 Red and Black 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1312 第二条深搜,题目并不难,但是做了我好久好久,由于一个细节,让我赌上了一个晚上的时间. 题目大意: ...
- HDU 1429 胜利大逃亡(续) (BFS+位压缩)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1429 胜利大逃亡(续) Time Limit: 4000/2000 MS (Java/Others) ...
- hdu 1272 小希的迷宫
Problem Description 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走.但是她设计迷宫的思路不一样,首先她认为所有的通道都应该 ...
- HDOJ 1157 HDU 1157 Who's in the Middle ACM 1157 IN HDU
MiYu原创, 转帖请注明 : 转载自 ______________白白の屋 题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=1157 题目描述: ...
最新文章
- Map.putAll()用法
- 医学科研中的作用_医学论文中参考文献的作用及常见类型
- java类二次加载_深入理解java之类加载器
- VSC为_计及功率控制模式的VSC-MTDC交直流并列运行系统概率潮流计算
- white-space详解
- LeetCode 384. 打乱数组(rand)
- 二叉搜索树的删除操作可以交换吗_JavaScript数据结构 — 二叉搜索树(BST)ES6实现...
- 【kafka】Number of insync replicas for partition __transaction_state-4 is below required minimum
- python上手_Python 上手
- linux安装tomcat后启动报错Cannot find ./catalina.sh的解决方法
- Download PuTTY: latest release (0.75) pscp
- java gson 解析json字符串_JSON 之GSON 解析
- 手机12306买卧铺下铺技巧_手机12306怎么买下铺(微信买火车票指定下铺)
- 罗马数字 java_Java算法练习——整数转罗马数字
- 一图看懂16个英语时态
- 关于JAVA的优势——跨平台和健壮性
- centos7 安装7z压缩命令
- iOS 打点上报、无痕埋点
- 一 、单片机IO实验
- 项目管理--关键链方法