P5082 Grades
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).
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 | $100$ | $120$ | $150$ |
| Actual score | $99$ | $73$ | $100$ |
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 $n$, the total number of subjects.
The second line contains $n$ integers $a_i$, where $a_i$ is the full score of the $i$-th subject.
The third line contains $n$ integers $b_i$, where $b_i$ is Xiao Ben’s actual score in the $i$-th subject.
Output Format
Output one number in a single line, representing his comprehensive grade. Keep $6$ digits after the decimal point.
Explanation/Hint
For $20$% of the testdata, the data is the sample.
For $100$% of the testdata, $n \le 1e7$.
Translated by ChatGPT 5