QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96270#5158. Interview QuestionAhmed_Abdelmegeed#WA 2ms3440kbC++20619b2023-04-13 18:19:212023-04-13 18:19:23

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 18:19:23]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3440kb
  • [2023-04-13 18:19:21]
  • 提交

answer

#include <bits/stdc++.h>


using namespace std;

int main() {
    int l,r;
    cin >> l >> r;
    cin.ignore();
    string s;
    getline(cin, s);
    stringstream ss(s);
    string cur;
    int a = 0, b = 0;
    while(ss >> cur)
    {
        if(cur == "Fizz")
            a = __gcd(a, l);
        if(cur == "Buzz")
            b = __gcd(b, l);
        if(cur == "FizzBuzz")
        {
            int x = __gcd(a,b);
            a = __gcd(a,x);
            b = __gcd(b,x);
            a = __gcd(a,l);
            b = __gcd(b, l);
        }
        ++l;
    }
    cout << a << " " << b;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3388kb

input:

7 11
7 8 Fizz Buzz 11

output:

9 10

result:

ok 

Test #2:

score: 0
Accepted
time: 2ms
memory: 3440kb

input:

49999 50002
49999 FizzBuzz 50001 Fizz

output:

2 50000

result:

ok 

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 3336kb

input:

8 11
Buzz Buzz FizzBuzz Buzz

output:

1 1

result:

FAIL Mismatch at position 8: expected Buzz, got FizzBuzz