QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#589727#9376. Gamemanba_outCompile Error//C++201.9kb2024-09-25 19:54:112024-09-25 19:54:15

Judging History

你现在查看的是最新测评结果

  • [2024-09-25 19:54:15]
  • 评测
  • [2024-09-25 19:54:11]
  • 提交

answer

#include <bits/stdc++.h>
#define low(x) ((x) & (-(x) ) )
#define E(x) ((x) * (x))
#define ma make_pair
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define inf 0x3f3f3f3f
using namespace std;
typedef long long LL;

char ch1;
template<class T>
inline void rd(T& x) {
	x = 0; bool w = 0;
	ch1 = getchar();
	while (!isdigit(ch1)) { ch1 == '-' && (w = 1), ch1 = getchar(); }
	while (isdigit(ch1)) { x = (x << 1) + (x << 3) + (ch1 & 15), ch1 = getchar(); }
	w && (x = (~x) + 1);
}
template<class T>
inline void wr(T x)
{
	if (x < 0) x = -x, putchar('-');
	if (x < 10) {
		putchar(x + 48);
		return;
	}
	T L = x / 10;
	wr(L);
	putchar(x - ((L << 1) + (L << 3)) + 48);
}
/*int head[N],tot;
struct edge{
	int to,nxt;
}e[M];

void add(int u,int v){
	e[++tot].to = v;
	e[tot].nxt = head[u];
	head[u] = tot;
}*/

bool cp(int a,int b){return a > b;} // \xb4\xf3\xb5\xbdС

int gcd(int a,int b){
	if(b == 0)return a;
	return gcd(b,a % b);
}

LL exgcd(LL a, LL b, LL &x, LL &y){
    if(b == 0){
        x = 1, y = 0;
        return a;
    }
    LL d = exgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
const LL mod = 998244353;
LL fpow(LL a,LL n){
	int ans = 1;
	a%=mod;
	while(n){
		if(n&1) ans = (ans*a)%mod;
		a = (a*a)%mod;
		n>>=1; 
	}
	return ans;
}


LL t,x,y,a0,a1,b,nb;

int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>t;
	LL k,r,p = 1,ans = 0,np = 1;
	while(t--){
		cin>>x>>y;cin>>a0>>a1>>b;
		p = 1;ans = 0;np = 1;
		b = a0+a1;
		nb = fpow(b,mod-2);
		while(x!=0&&y!=0){
			if(x>=y){
				k = x/y;
				p = fpow(a1,k)*fpow(nb,k)%mod;
				ans=(ans+(mod+1-p)%mod*np)%mod;
				np= np*p%mod;
				x%=y;
			}
			else{
				k = y/x;
				p = fpow(a0,k)*fpow(nb,k)%mod;
				np = np*p%mod
				y%=x;
				if(y==0)ans=(ans+np)%mod;
			}
		}
		cout<<ans<<'\n';
	}
	return 0;
}



Details

answer.code: In function ‘int main()’:
answer.code:94:46: error: expected ‘;’ before ‘y’
   94 |                                 np = np*p%mod
      |                                              ^
      |                                              ;
   95 |                                 y%=x;
      |                                 ~