QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#487038#5344. Odd and Even ZeroesPetroTarnavskyi#Compile Error//C++201002b2024-07-22 15:29:542024-07-22 15:29:55

Judging History

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

  • [2024-07-22 15:29:55]
  • 评测
  • [2024-07-22 15:29:54]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

PII f(int k)
{
	if (k == 0)
		return {1, 0};
	auto [f0, f1] = f(k -1);
	if (k % 2 == 0)
		return {5 * f0, 5 * f1};
	else
		return {3 * f0 + 2 * f1, 3 * f1 + 2 * f0};
}

LL solve(LL n, int t)
{
	if (n == 0)
		return 0;
	int pw = 0;
	LL val = 1;
	while (val * 5 <= n)
	{
		pw++;
		val *= 5;
	}
	auto [f0, f1] = f(pw);		
	return (t == 0 ? f0 : f1) + solve(n - val, t ^ (pw % 2));
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	while (true)
	{
		LL n;
		cin >> n;
		if (n == -1)
			return 0;
		cout << solve(n + 1, 0) << '\n';
	}
	return 0;
}
ggg

Details

answer.code:60:1: error: ‘ggg’ does not name a type
   60 | ggg
      | ^~~