http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=892&pid=1001
把p/100当做每次alice攻击b掉的血量,那么b会在m/(p/100)天死亡,由于是alice先手,那么b的攻击天数会是m/(p/100)-1,那么它能让alice掉的血就是(m/(p/100)-1)*q/100,然后把alice命中m次加的m血加上就是答案
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
const int maxl=3e5+10;
const int mod=998244353;
int n,cas,k,cnt,tot;
ll m,p,q,ans;
int a[maxl],b[maxl];
char s[maxl];
bool in[maxl];
inline void prework()
{
scanf("%lld%lld%lld",&m,&p,&q);
}
inline ll qp(int a,ll b)
{
ll ans=1,cnt=a;
while(b)
{
if(b&1)
ans=ans*cnt%mod;
cnt=cnt*cnt%mod;
b>>=1;
}
return ans;
}
inline void mainwork()
{
ll tp=m*100%mod*qp(p,mod-2)%mod;
ll tq=(tp-1+mod)%mod;
ans=tq*q%mod*qp(100,mod-2)%mod;
ans=(m-ans+mod)%mod;
}
inline void print()
{
printf("%lld\n",ans);
}
int main()
{
int t=1;
scanf("%d",&t);
for(cas=1;cas<=t;cas++)
{
prework();
mainwork();
print();
}
return 0;
}