luogu#P5082. 成绩

成绩

Background

Xiao Ben’s score.

Solution: https://blog.csdn.net/kkkksc03/article/details/84928268

One note: the memory limit for this problem has been relaxed (but it seems you can get AC without even using arrays).

Problem Description

Xiao Ben’s final exams have ended.

His grades will be released soon.

You are given an exam score table, for example:

Subject / Score Type Chinese Math English
Full score 100100 120120 150150
Actual score 9999 7373 100100

Of course, the teachers at school think that entering so many grades makes it hard to calculate, so they want you to compute a comprehensive grade evaluation.

The comprehensive grade evaluation is defined as: $(\text{sum of full scores} \times 3 - \text{sum of actual scores} \times 2) \div \text{sum of points deducted for each subject}$.

Xiao Ben wants you to output his comprehensive grade. Can you do it?

Input Format

The first line contains an integer nn, the total number of subjects.
The second line contains nn integers aia_i, where aia_i is the full score of the ii-th subject.
The third line contains nn integers bib_i, where bib_i is Xiao Ben’s actual score in the ii-th subject.

Output Format

Output one number in a single line, representing his comprehensive grade. Keep 66 digits after the decimal point.

3
10 10 10
5 5 5
4.000000

Hint

For 2020% of the testdata, the data is the sample.

For 100100% of the testdata, n1e7n \le 1e7.

Translated by ChatGPT 5