QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#593333#6566. Power of Divisorsticking_away#Compile Error//C++203.8kb2024-09-27 13:21:242024-09-27 13:21:24

Judging History

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

  • [2024-09-27 13:21:24]
  • 评测
  • [2024-09-27 13:21:24]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using ull = unsigned long long;
using ll = long long;
#define endl '\n'
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int maxn = 2e5 + 10;
const int mod = 1000000007;
#define inl inline
#define fr(i, a, b) for (int i = a; i <= b; i++)
#define ford(i, a, b) for (int i = a; i >= b; i--)
#define forall(i, a) for (auto &i : a)

/**
   ____         ___ _____
  / ___| _   _ / _ \___ /
  \___ \| | | | | | ||_ \
   ___) | |_| | |_| |__) |
  |____/ \__, |\___/____/
         |___/
*/
istream &operator>>(istream &in, vector<int> &v)
{
    for (auto &i : v)
        in >> i;
    return in;
}
ostream &operator<<(ostream &out, vector<int> &v)
{
    for (auto &i : v)#include <bits/stdc++.h>
using namespace std;
using ui = unsigned int;
using ull = unsigned long long;
using ll = long long;
#define endl '\n'
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int maxn = 2e5 + 10;
const int mod = 1000000007;
#define inl inline
#define fr(i, a, b) for (int i = a; i <= b; i++)
#define ford(i, a, b) for (int i = a; i >= b; i--)
#define forall(i, a) for (auto &i : a)

/**
   ____         ___ _____
  / ___| _   _ / _ \___ /
  \___ \| | | | | | ||_ \
   ___) | |_| | |_| |__) |
  |____/ \__, |\___/____/
         |___/
*/
istream &operator>>(istream &in, vector<int> &v)
{
    for (auto &i : v)
        in >> i;
    return in;
}
ostream &operator<<(ostream &out, vector<int> &v)
{
    for (auto &i : v)
        out << i << " ";
    return out;
}
bool _output = 0;

#define int ll
void solve()
{
    int x;
    cin >> x;
    if (x == 1)
    {
        cout << 1 << endl;
        return;
    }
    using db = double;
    auto make = [&](int r)
    {
        int p = pow((db)x, (db)1.0 / r) + 0.5;
        ll t = x;
        if (p <= 1)
            return 0;
        for (int i = 1; i <= r; i++)
        {
            if (t % p)
                return 0;
            t /= p;
        }
        if (t != 1)
            return 0;
        for (int i = 1; i * i <= p; i++)
        {
            if (p % i == 0)
            {
                r--;
                if (p / i != i)
                    r--;
            }
        }
        if (r)
            return 0;
        cout << p << endl;
        return 1;
    };
    for (int i = 20; i >= 2; i--)
    {
        if (make(i))
        {
            return;
        }
    }
    cout << -1 << endl;
    return;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    if (_output)
        cin >> _;
    while (_--)
        solve();
    return 0;
}
        out << i << " ";
    return out;
}
bool _output = 0;

#define int ll
void solve()
{
    int x;
    cin >> x;
    if (x == 1)
    {
        cout << 1 << endl;
        return;
    }
    using db = double;
    auto make = [&](int r)
    {
        int p = pow((db)x, (db)1.0 / r) + 0.5;
        ll t = x;
        if (p <= 1)
            return 0;
        for (int i = 1; i <= r; i++)
        {
            if (t % p)
                return 0;
            t /= p;
        }
        if (t != 1)
            return 0;
        for (int i = 1; i * i <= p; i++)
        {
            if (p % i == 0)
            {
                r--;
                if (p / i != i)
                    r--;
            }
        }
        if (r)
            return 0;
        cout << p << endl;
        return 1;
    };
    for (int i = 20; i >= 2; i--)
    {
        if (make(i))
        {
            return;
        }
    }
    cout << -1 << endl;
    return;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    if (_output)
        cin >> _;
    while (_--)
        solve();
    return 0;
}

详细

answer.code:32:22: error: stray ‘#’ in program
   32 |     for (auto &i : v)#include <bits/stdc++.h>
      |                      ^
answer.code: In function ‘std::ostream& operator<<(std::ostream&, std::vector<int>&)’:
answer.code:32:32: error: ‘bits’ was not declared in this scope
   32 |     for (auto &i : v)#include <bits/stdc++.h>
      |                                ^~~~
answer.code:32:37: error: ‘stdc’ was not declared in this scope; did you mean ‘std’?
   32 |     for (auto &i : v)#include <bits/stdc++.h>
      |                                     ^~~~
      |                                     std
answer.code:32:23: error: ‘include’ was not declared in this scope
   32 |     for (auto &i : v)#include <bits/stdc++.h>
      |                       ^~~~~~~
answer.code:33:1: error: expected primary-expression before ‘using’
   33 | using namespace std;
      | ^~~~~
answer.code:56:1: error: a function-definition is not allowed here before ‘{’ token
   56 | {
      | ^
answer.code:62:1: error: a function-definition is not allowed here before ‘{’ token
   62 | {
      | ^
answer.code:71:1: error: a function-definition is not allowed here before ‘{’ token
   71 | {
      | ^
answer.code:118:12: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  118 | signed main()
      |            ^~
answer.code:118:12: note: remove parentheses to default-initialize a variable
  118 | signed main()
      |            ^~
      |            --
answer.code:118:12: note: or replace parentheses with braces to value-initialize a variable
answer.code:119:1: error: a function-definition is not allowed here before ‘{’ token
  119 | {
      | ^
answer.code:130:16: error: ‘i’ was not declared in this scope; did you mean ‘ui’?
  130 |         out << i << " ";
      |                ^
      |                ui