QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#105067#6387. BurgersBucketsmithCompile Error//C++14872b2023-05-12 21:38:132023-05-12 21:38:17

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-12 21:38:17]
  • 评测
  • [2023-05-12 21:38:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 10;

int n, x[N], a[N], b[N];

double check(double c) {
    double ret = 1e9 + 7;
    for(int i = 1; i <= n; i ++) {
        if(a[i] * c > x[i]) return -1;
        ret = min(ret, (x[i] - a[i] * c) / b[i]);
    }
    return c + ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    for(int i = 1; i <= n; i ++) cin >> x[i];
    for(int i = 1; i <= n; i ++) cin >> a[i];
    for(int i = 1; i <= n; i ++) cin >> b[i];

    double l = 0, r = 1e9 + 7;
    for(int i = 1; i <= n; i ++)
        r = min(r, x[i] * 1.0 / a[i]);
    
    for(int i = 1; i <= 60; i ++)
        double m1 = (l + r) / 2, m2 = m1 + 0.01;
        if(check(m1) <= check(m2)) l = m1;
        else r = m2;
    }
    cout << (int)max(check(floor(l)), check(ceil(l)));

}

Details

answer.code: In function ‘int main()’:
answer.code:32:18: error: ‘m1’ was not declared in this scope; did you mean ‘y1’?
   32 |         if(check(m1) <= check(m2)) l = m1;
      |                  ^~
      |                  y1
answer.code:32:31: error: ‘m2’ was not declared in this scope
   32 |         if(check(m1) <= check(m2)) l = m1;
      |                               ^~
answer.code: At global scope:
answer.code:35:5: error: ‘cout’ does not name a type
   35 |     cout << (int)max(check(floor(l)), check(ceil(l)));
      |     ^~~~
answer.code:37:1: error: expected declaration before ‘}’ token
   37 | }
      | ^