NC206677. EndAsGPA
描述
At the end of term, Makise Von got a poor grade.
Now Makise Von wonders if EndA's GPA is really 4.0, and he has almost made it.
There are n exams, and EndA's score of the i-th exam is ai .
Beside, it's known that the i-th exam's proportion of the GPA is pi% .
So let EndA's GPA be ans , then
Help Makise Von judge that if EndA's GPA is 4.0.
输入描述
The first line of the input contains a single interger number n (1 <= n <= 20).
The second line of the input contains n interger numbers a1, a2, ..., an (0 <= ai <= 10^2), which are separated by spaces.
The third line of the input contains n interger numbers p1, p2, ..., pn (0 <= pi <= 10^2), which are separated by spaces.
It is guaranteed that , and the absolute error of the answer should be less than 10^(-2).
输出描述
If EndA's GPA is 4.0 print Yes, else print No (without quotes).
示例1
输入:
2 49 71 91 9
输出:
No
示例2
输入:
3 100 100 100 28 25 47
输出:
Yes
Python3(3.5.2) 解法, 执行用时: 25ms, 内存消耗: 3556K, 提交时间: 2020-06-13 14:12:42
n=eval(input()) list1 = list(map(int,input().split())) list2 = list(map(int,input().split())) sum=0 for i in range(n): sum+=list1[i]*list2[i] if sum>=9998: print("Yes") else: print("No")
pypy3(pypy3.6.1) 解法, 执行用时: 68ms, 内存消耗: 24248K, 提交时间: 2020-06-13 16:13:09
input() ans = sum(list(map(lambda x, y : x * y / 100, [int(i) for i in input().split()], [int(i) for i in input().split()]))) / 25 print("Yes" if ans < 4.01 and ans > 3.99 else "No")