QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#140674#5158. Interview QuestionAs3b_team_f_masr#WA 1ms3576kbC++14792b2023-08-16 16:36:042023-08-16 16:36:07

Judging History

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

  • [2023-08-16 16:36:07]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3576kb
  • [2023-08-16 16:36:04]
  • 提交

answer

#include <bits/stdc++.h>

typedef long double ld;
typedef long long ll;
using namespace std;
int di[] = {1, 0, -1, 0, 0, 1, -1, 1};
int dj[] = {0, 1, 0, -1, -1, 0, 1, -1};
const ll oo = 1e18, MOD = 1e9 + 7;
const int N = 1e6 + 5, M = 30005;


int t, n, m;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //freopen("output.txt", "w", stdout);
    int l, r;
    cin >> l >> r;
    int g1 = 0, g2 = 0;
    for (int i = l; i <= r; i++) {
        string s;
        cin >> s;
        if (s == "Fizz") g1 = __gcd(g1, i);
        else if (s == "Buzz") g2 = __gcd(g2, i);
        else if (s == "FizzBuzz") g1 = __gcd(g1, i), g2 = __gcd(g2, i);
    }
    if (!g1) g1 = 1e7;
    if (!g2) g2 = 1e7;
    cout << g1 << " " << g2;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3456kb

input:

7 11
7 8 Fizz Buzz 11

output:

9 10

result:

ok 

Test #2:

score: 0
Accepted
time: 1ms
memory: 3464kb

input:

49999 50002
49999 FizzBuzz 50001 Fizz

output:

2 50000

result:

ok 

Test #3:

score: 0
Accepted
time: 1ms
memory: 3576kb

input:

8 11
Buzz Buzz FizzBuzz Buzz

output:

10 1

result:

ok 

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3464kb

input:

10 15
10 11 12 13 14 15

output:

10000000 10000000

result:

wrong answer Integer parameter [name=a] equals to 10000000, violates the range [1, 1000000]