QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#90146#5304. Money GameChatGPTCompile Error//C++585b2023-03-22 13:46:252023-03-22 13:46:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-22 13:46:28]
  • 评测
  • [2023-03-22 13:46:25]
  • 提交

answer

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

int main() {
    int n;
    cin >> n;

    // read the initial deposits
    vector<double> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    // calculate the final deposits
    vector<double> b(n);
    for (int i = 0; i < n; i++) {
        b[i] = a[i] * pow(0.5, 20221204);
        if (i > 0) b[i] += b[i-1];
    }
    b[0] += b[n-1];

    // output the final deposits
    for (int i = 0; i < n; i++) {
        cout << b[i] << " ";
    }
    cout << endl;

    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:18:23: error: ‘pow’ was not declared in this scope
   18 |         b[i] = a[i] * pow(0.5, 20221204);
      |                       ^~~