QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#501076 | #5158. Interview Question | xixu | Compile Error | / | / | C++14 | 1.2kb | 2024-08-02 13:38:45 | 2024-08-02 13:38:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
// #define int long long
typedef long long ll;
typedef pair<int , int> PII;
const int N = 1e5 + 10;
vector<int> a , b;
void solve()
{
int c , d;
cin >> c >> d;
for(int i = c; i <= d; i ++)
{
string s;
cin >> s;
if(s == "Fizz")
{
a.push_back(i);
}
else if(s == "Buzz")
{
b.push_back(i);
}
else if(s == "FizzBuzz")
{
a.push_back(i);
b.push_back(i);
}
}
int ans;
if(a.size())
{
ans = a[0];
}
else
{
ans = d + 1;
}
for(int i = 0; i < a.size(); i ++)
{
ans = gcd(ans , a[i]);
}
cout << ans << ' ';
if(b.size()) ans = b[0];
else ans = d + 1;
for(int i = 0; i < b.size(); i ++)
{
ans = gcd(ans , b[i]);
}
cout << ans << '\n';
}
signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int t = 1;
// cin >> t;
while(t --)
{
solve();
}
return 0;
}
詳細信息
answer.code: In function ‘void solve()’: answer.code:50:15: error: ‘gcd’ was not declared in this scope 50 | ans = gcd(ans , a[i]); | ^~~ answer.code:60:15: error: ‘gcd’ was not declared in this scope 60 | ans = gcd(ans , b[i]); | ^~~