QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#590707#9376. GameChief_NingCompile Error//C++141.0kb2024-09-26 10:23:412024-09-26 10:23:42

Judging History

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

  • [2024-09-26 10:23:42]
  • 评测
  • [2024-09-26 10:23:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

using u64 = unsigned long long;
using u32 = unsigned int;
using i64 = long long;

mt19937_64 rnd(random_device{}());

const int mod = 998244353;
const int N = 3e5 + 5;
const int M = 2e6 + 5;

int n, m, s, t;

i64 fastpow(i64 a, int n) {
	i64 res = 1;
	a %= mod;
	while(n) {
		if(n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

i64 rev(i64 a) {
	return fastpow(a, mod - 2);
}

void RuinGuard(int tc)
{
	int x, y;
	
	cin >> x >> y;
	 
	int a, b, c;
	
	cin >> a >> b >> c;
	
	int pa = a * rev(a + b) % mod, pb = b * rev(a + b) % mod;
	
	auto f = [&](int x, int y, int pa, int pb) -> int {
		if(!x) return 0;
		return fastpow(pa, y / x) * (1 - f(y % x, x, b, a) + mod) % mod;
	};
	
	return cout << f(x, y, pa, pb) << '\n';
}

signed main()
{ 
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    int testcase = 1;
	cin >> testcase;
	
    for(int tc = 1; tc <= testcase; tc++) {
    	RuinGuard(tc);
	}

    return 0;
}

Details

answer.code: In lambda function:
answer.code:45:50: error: use of ‘f’ before deduction of ‘auto’
   45 |                 return fastpow(pa, y / x) * (1 - f(y % x, x, b, a) + mod) % mod;
      |                                                  ^
answer.code: In function ‘void RuinGuard(int)’:
answer.code:48:40: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
   48 |         return cout << f(x, y, pa, pb) << '\n';
      |                ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~