脚本宝典收集整理的这篇文章主要介绍了2019杭电多校 permutation2,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
PRoblem:http://acm.hdu.edu.cn/contests/contest_showproblem.PHP?pid=1007&cid=852
#include<bITs/stdc++.h> using namespace std; tyPEdef long long ll; ll d[100005]; void f() { d[1]=d[2]=d[3]=1; for(int i=4;i<=100001;i++) d[i]=(d[i-1]+d[i-3])%998244353; } int main() { f();int t;scanf("%d",&t); while(t--) { ll n,x,y; scanf("%lld%lld%lld",&n,&x,&y); if(x==1&&y==n) printf("%d\n",d[n]); else if(x==1) printf("%d\n",d[y-1]); else if(y==n) printf("%d\n",d[n-x]); else printf("%d\n",d[y-x-1]); } return 0; }
以上是脚本宝典为你收集整理的2019杭电多校 permutation2全部内容,希望文章能够帮你解决2019杭电多校 permutation2所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。