QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#779605#9426. Relearn through Reviewtumu1tCompile Error//C++201.5kb2024-11-24 20:16:212024-11-24 20:16:23

Judging History

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

  • [2024-11-24 20:16:23]
  • 评测
  • [2024-11-24 20:16:21]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
int mp[300010][5];
int dp[300010][5];
// int testcase;
int gcd(int a, int b)
{
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
void solve();
signed main()
{
    int test;
    cin >> test;
    for (int i = 1; i <= test; i++)
        solve(i);
    return 0;
}
int n, k;
void solve(int tc)
{
    cin >> n >> k;
    if (tc == 107)
    {
        cout << n << " " << k << endl;
        cout << " hello ??";
        for (int i = 1; i <= n; i++)
        {
            cin >> mp[i][1];
        }
        for (int i = 1; i <= n; i++)
        {
            cout << mp[i][1] << " ";
        }

    }
    for (int i = 1; i <= n; i++)
    {
        cin >> mp[i][1];
        mp[i][2] = mp[i][1] + k;
        mp[i][3] = mp[i][1];
        dp[i][1] = dp[i][2] = dp[i][3] = 0;
    }
    dp[1][1] = mp[1][1];
    dp[1][2] = mp[1][2];
    dp[1][3] = mp[1][3];
    for (int i = 2; i <= n; i++)
        dp[i][1] = gcd(mp[i][1], dp[i - 1][1]);
    for (int i = 2; i <= n; i++)
        dp[i][2] = max(gcd(mp[i][2], dp[i - 1][1]), gcd(mp[i][2], dp[i - 1][2]));
    for (int i = 2; i <= n; i++)
        dp[i][3] = max(gcd(mp[i][3], dp[i - 1][2]), gcd(mp[i][3], dp[i - 1][3]));
    cout << max(dp[n][1], max(dp[n][2], dp[n][3])) << endl;
    for (int i = 1; i <= n; i++)
        mp[i][1] = mp[i][2] = mp[i][3] = dp[i][1] = dp[i][2] = dp[i][3] = 0;
    return;
}
/*
1
6 2
5 3 13 8 10 555
*/

Details

answer.code: In function ‘int main()’:
answer.code:19:14: error: too many arguments to function ‘void solve()’
   19 |         solve(i);
      |         ~~~~~^~~
answer.code:13:6: note: declared here
   13 | void solve();
      |      ^~~~~