QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#795135#9784. Donkey and Puss in Bootsucup-team139Compile Error//C++23387b2024-11-30 18:02:362024-11-30 18:02:39

Judging History

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

  • [2024-11-30 18:02:39]
  • 评测
  • [2024-11-30 18:02:36]
  • 提交

answer

#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  long long sum = 0;
  vector<int> v(n);
  for (auto &i : v)
  {
    cin >> i;
    sum += i;
  }

  sort(v.rbegin(), v.rend());
  if (sum - v[0] < n)
  {
    cout << "Donkey\n";
  }
  else
  {
    cout << "Puss in Boots\n";
  }
}

Details

answer.code: In function ‘int main()’:
answer.code:13:3: error: ‘vector’ was not declared in this scope
   13 |   vector<int> v(n);
      |   ^~~~~~
answer.code:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
answer.code:13:10: error: expected primary-expression before ‘int’
   13 |   vector<int> v(n);
      |          ^~~
answer.code:14:18: error: ‘v’ was not declared in this scope
   14 |   for (auto &i : v)
      |                  ^
answer.code:20:8: error: ‘v’ was not declared in this scope
   20 |   sort(v.rbegin(), v.rend());
      |        ^