QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#749736#7694. CornhuskeralexhamidiCompile Error//C++14439b2024-11-15 09:47:292024-11-15 09:47:30

Judging History

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

  • [2024-11-15 09:47:30]
  • 评测
  • [2024-11-15 09:47:29]
  • 提交

answer

#include <iostream>
using namespace std;

int main() {

    vector<int> A(5);
    vector<int> L(5);

    for (int i = 0; i < 5; i++) {
        cin >> A[i] >> L[i];
    }

    int n, KWF;

    cin >> n >> KWF;

    int nk = 0;
    for (int i = 0; i < 5; i++) {
        nk += A[i] * L[i];
    }
    int ak  = nk/5;

    int nkt = ak * n;

    int ans = nkt/KWF;

    cout << ans;

    return 0;
}

/*


*/

Details

answer.code: In function ‘int main()’:
answer.code:6:5: error: ‘vector’ was not declared in this scope
    6 |     vector<int> A(5);
      |     ^~~~~~
answer.code:2:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
answer.code:6:12: error: expected primary-expression before ‘int’
    6 |     vector<int> A(5);
      |            ^~~
answer.code:7:12: error: expected primary-expression before ‘int’
    7 |     vector<int> L(5);
      |            ^~~
answer.code:10:16: error: ‘A’ was not declared in this scope
   10 |         cin >> A[i] >> L[i];
      |                ^
answer.code:10:24: error: ‘L’ was not declared in this scope
   10 |         cin >> A[i] >> L[i];
      |                        ^
answer.code:19:15: error: ‘A’ was not declared in this scope
   19 |         nk += A[i] * L[i];
      |               ^
answer.code:19:22: error: ‘L’ was not declared in this scope
   19 |         nk += A[i] * L[i];
      |                      ^