NC18999. Relic Discovery
描述
输入描述
The first line of input contains an integer T which is the number of test cases. For each test case, the first line contains an integer N which is the number of types. In the next N lines, the i-th line contains two numbers Ai and Bi as described above. All numbers are positive integers and less than 101.
输出描述
For each case, output one integer, the total expenditure in million dollars.
示例1
输入:
1 2 1 2 3 4
输出:
14
pypy3(pypy3.6.1) 解法, 执行用时: 273ms, 内存消耗: 23120K, 提交时间: 2020-06-03 00:50:22
t=int(input()) while(t>0): t-=1 n=int(input());ans=0 for i in range(n): x,y=map(int, input().split()) ans+=x*y print(ans)
Python3(3.5.2) 解法, 执行用时: 55ms, 内存消耗: 3428K, 提交时间: 2020-06-11 10:18:22
t = int(input()) for i in range(0,t): n = int(input()) sum = 0 for i in range(0,n): a, b = map(int, input().split()) sum += a*b print(sum)