列表

详情


NP42. 公式计算器

描述

牛客网为员工举行了一项快速心算大赛,需要程序员大大写一款涉及加减乘除的验算小程序。假如输入的数字分别是x、y、z、k,请输出x+y的结果与z-k的结果相乘的值。

输入描述

一行输入四个整数,以空格间隔。

输出描述

直接输出计算结果,结果一定是整数。

示例1

输入:

1 2 3 4

输出:

-3

原站题解

Python 3 解法, 执行用时: 29ms, 内存消耗: 4492KB, 提交时间: 2022-07-28

x,y,z,k=map(int,input().split())
print((x+y)*(z-k))

Python 3 解法, 执行用时: 30ms, 内存消耗: 4480KB, 提交时间: 2022-07-31

a,s,d,f = map(int,input().split(" "))
print((a+s)*(d-f))

Python 3 解法, 执行用时: 30ms, 内存消耗: 4484KB, 提交时间: 2022-07-30

x=input().split()
a=int(x[0])+int(x[1])
b=int(x[2])-int(x[3])
print(a*b)

Python 3 解法, 执行用时: 30ms, 内存消耗: 4492KB, 提交时间: 2022-07-27

x = input()

x = x.split(' ')
x = [int(i) for i in x]
print((x[0]+x[1])*(x[2]-x[3]))

Python 3 解法, 执行用时: 30ms, 内存消耗: 4512KB, 提交时间: 2022-07-29

num=input().split()
l=[int(i) for i in num]
print((l[0]+l[1])*(l[2]-l[3]))

上一题