QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96270 | #5158. Interview Question | Ahmed_Abdelmegeed# | WA | 2ms | 3440kb | C++20 | 619b | 2023-04-13 18:19:21 | 2023-04-13 18:19:23 |
Judging History
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