又易知 f(t)=t,可得 f(q)=2^{q-t}t。令 q=x,则使得场上仅有 x 级的西瓜需要 2^{x-t}t=2^{x-y-1}(y+1) 个基础西瓜。
## 最终代码
```cpp
#include<bits/stdc++.h>
using namespace std;
int t;
const long long MOD=998244353;
long long fast_pow(long long a,long long b)
{
long long ans=1;
a%=MOD;
while(b)
{
if(b&1) ans=(ans*a)%MOD;
a=(a*a)%MOD,b>>=1;
}
return ans;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>t;
while(t--)
{
int x,y;
cin>>x>>y;
cout<<(x<=y?1:fast_pow(2,x-y-1)*((y+1)%MOD)%MOD)<<endl;
}
return 0;
}
```
时间复杂度:$\mathcal{O}(t\log(x-y))