QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#116753#5158. Interview Questionbatrr#Compile Error//C++141.6kb2023-06-30 01:34:022023-06-30 01:34:06

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-30 01:34:06]
  • 评测
  • [2023-06-30 01:34:02]
  • 提交

answer

#include <bits/stdc++.h>

#define f first
#define s second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int N = 300500, inf = 1e9, mod = 998244353;
const ll INF = 1e18;

int sum(int a, int b) {
    a += b;
    if (a >= mod)
        a -= mod;
    return a;
}

int sub(int a, int b) {
    a -= b;
    if (a < 0)
        a += mod;
    return a;
}

int mult(int a, int b) {
    return 1ll * a * b % mod;
}

int bp(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1)
            res = mult(res, a);
        a = mult(a, a);
        b >>= 1;
    }
    return res;
}

int inv(int x) {
    return bp(x, mod - 2);
}

int a[N];
int c, d;

void solve() {
    cin >> c >> d;
    for (int i = c; i <= d; i++) {
        string s;
        cin >> s;
        if (s == "Fizz")
            a[i] = 1;
        else if (s == "Buzz")
            a[i] = 2;
        else if (s == "FizzBuzz")
            a[i] = 3;
        else
            a[i] = 0;
    }
    int A = 0, B = 0;
    for(int i = c; i <= d; i++){
        if(a[i] & 1)
            A = gcd(A, i);
        if(a[i] & 2)
            B = gcd(B, i);
    }
    if(A == 0)
        A = 1e6;
    if(B == 0)
        B = 1e6;
    cout << A << " " << B << endl;
}

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    int t = 1;
//    cin >> t;
    for (int i = 1; i <= t; i++) {
//        cout << "Case #" << i << endl;
        solve();
    }
}

詳細信息

answer.code: In function ‘void solve()’:
answer.code:70:17: error: ‘gcd’ was not declared in this scope
   70 |             A = gcd(A, i);
      |                 ^~~
answer.code:72:17: error: ‘gcd’ was not declared in this scope
   72 |             B = gcd(B, i);
      |                 ^~~