QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623885#9423. Gold MedalDevid_GuaZi#Compile Error//C++17669b2024-10-09 14:18:522024-10-09 14:18:52

Judging History

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

  • [2024-10-09 14:18:52]
  • 评测
  • [2024-10-09 14:18:52]
  • 提交

answer

void solve()
{
    ll n, k;
    cin >> n >> k;
    vl a(n);
    ll ans = 0;
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        ans += a[i] / k;
        a[i] = k - a[i] % k;
    }
    ll m;
    cin >> m;
    sort_all(a);
    for (ll i = 0; i < n; i++)
    {
        if (a[i] <= m)
        {
            m -= a[i];
            ans++;
        }
        else
            break;
    }
    ans += m / k;
    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);
    int _ = 1;
    std::cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:3:5: error: ‘ll’ was not declared in this scope
    3 |     ll n, k;
      |     ^~
answer.code:4:5: error: ‘cin’ was not declared in this scope
    4 |     cin >> n >> k;
      |     ^~~
answer.code:4:12: error: ‘n’ was not declared in this scope
    4 |     cin >> n >> k;
      |            ^
answer.code:4:17: error: ‘k’ was not declared in this scope
    4 |     cin >> n >> k;
      |                 ^
answer.code:5:5: error: ‘vl’ was not declared in this scope
    5 |     vl a(n);
      |     ^~
answer.code:6:7: error: expected ‘;’ before ‘ans’
    6 |     ll ans = 0;
      |       ^~~~
      |       ;
answer.code:7:12: error: expected ‘;’ before ‘i’
    7 |     for (ll i = 0; i < n; i++)
      |            ^~
      |            ;
answer.code:7:20: error: ‘i’ was not declared in this scope
    7 |     for (ll i = 0; i < n; i++)
      |                    ^
answer.code:9:16: error: ‘a’ was not declared in this scope
    9 |         cin >> a[i];
      |                ^
answer.code:10:9: error: ‘ans’ was not declared in this scope
   10 |         ans += a[i] / k;
      |         ^~~
answer.code:13:7: error: expected ‘;’ before ‘m’
   13 |     ll m;
      |       ^~
      |       ;
answer.code:14:12: error: ‘m’ was not declared in this scope
   14 |     cin >> m;
      |            ^
answer.code:15:14: error: ‘a’ was not declared in this scope
   15 |     sort_all(a);
      |              ^
answer.code:15:5: error: ‘sort_all’ was not declared in this scope
   15 |     sort_all(a);
      |     ^~~~~~~~
answer.code:16:12: error: expected ‘;’ before ‘i’
   16 |     for (ll i = 0; i < n; i++)
      |            ^~
      |            ;
answer.code:16:20: error: ‘i’ was not declared in this scope
   16 |     for (ll i = 0; i < n; i++)
      |                    ^
answer.code:21:13: error: ‘ans’ was not declared in this scope
   21 |             ans++;
      |             ^~~
answer.code:26:5: error: ‘ans’ was not declared in this scope
   26 |     ans += m / k;
      |     ^~~
answer.code:27:5: error: ‘cout’ was not declared in this scope
   27 |     cout << ans << endl;
      |     ^~~~
answer.code:27:20: error: ‘endl’ was not declared in this scope
   27 |     cout << ans << endl;
      |                    ^~~~
answer.code: In function ‘int main()’:
answer.code:32:5: error: ‘ios’ has not been declared
   32 |     ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);
      |     ^~~
answer.code:32:39: error: ‘cin’ is not a member of ‘std’
   32 |     ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);
      |                                       ^~~
answer.code:1:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
  +++ |+#include <iostream>
    1 | void solve()
answer.code:32:62: error: ‘cout’ is not a member of ‘std’
   32 |     ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr);
      |                                                              ^~~~
answer.code:32:62: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code:34:10: error: ‘cin’ is not a member of ‘std’
   34 |     std::cin >> _;
      |          ^~~
answer.code:34:10: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?