题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6425
题目大意:一群人打羽毛球,a个人啥都没有,b个人只有一个拍,c个人只有一个球,d个人有一个拍一个球,只有同时有两个拍一个球才能一起打,问多少种情况不能一起打
题目思路:
以下是代码:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
#define inf 0x3f3f3f3f
#define MAXN 150005
#define MOD 998244353
#define ll long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
ll quickpow(ll x,ll y){
if(!y)return 1;
ll temp=quickpow(x,y/2);
temp*=temp;
temp%=MOD;
if(y&1){
temp*=x;
temp%=MOD;
}
return temp;
}
int main(){
int t;
ll a,b,c,d;
scanf("%d",&t);
while(t--){
scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
ll ans=quickpow(2,a+c);
ans=((b+d+1)*ans)%MOD;
ans=(ans+quickpow(2,a+b));
ans=(ans-(quickpow(2,a)*(b+1))%MOD)%MOD;
ans=(ans+MOD)%MOD;
printf("%lld\n",ans);
}
return 0;
}