2019杭电多校 permutation2
发布时间:2020-12-13 22:16:34 所属栏目:PHP教程 来源:网络整理
导读:Problem: http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1007cid=852 #includebits/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
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("%dn",d[n]); else if(x==1) printf("%dn",d[y-1]); else if(y==n) printf("%dn",d[n-x]); else printf("%dn",d[y-x-1]); } return 0; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |