QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#586075#9376. Gamedaniel14311531Compile Error//Python3638b2024-09-24 01:01:592024-09-24 01:02:00

Judging History

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

  • [2024-09-24 01:02:00]
  • 评测
  • [2024-09-24 01:01:59]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 998244353;
int p1, p2;

int inv(int x) {
	if(x <= 1) return 1;
	return 1ll * (mod - mod / x) * inv(mod % x) % mod;
}
int calc(int x, int y) {
	if(y <= 0) return 1;
	if(x <= 0) return 0;
	return (1ll * p1 * calc(x, y - x) + 1ll * p2 * calc(x - y, y)) % mod;
}
int main() {
	ios::sync_with_stdio(0); cin.tie(nullptr);
	int T; cin >> T;
	for(; T; --T) {
		int x, y, s; cin >> x >> y;
		cin >> p1 >> p2 >> s; s = p1 + p2;
		p1 = 1ll * p1 * inv(s) % mod;
		p2 = 1ll * p2 * inv(s) % mod;
		cout << calc(x, y) << "\n";
	}	
	return 0;
}

详细

  File "answer.code", line 9
    	return 1ll * (mod - mod / x) * inv(mod % x) % mod;
    	       ^
SyntaxError: invalid decimal literal