https://ac.nowcoder.com/acm/contest/338/G

链接:https://ac.nowcoder.com/acm/contest/338/G
来源:牛客网

题目描述

This is a very simple problem! Your only job is to calculate a + b + c + d!

输入描述:

There are several cases.

In the first line, there is a single integer T.(T <= 200)

In the next T lines, each line contains four integers a, b, c and d(-2^61 <= a,b,c,d <=2^61)

输出描述:

output T lines.

Each line output one integer represent the answer of a + b + c + d
示例1

输入

复制

1
1 2 3 4

输出

复制

10

不换行
n=int(input())
for i in range(n):
a,b,c,d = map(int,input().split())
print(a+b+c+d)

换行

n=int(input())
for i in range(n):
m=int(input())
a=int(input())
b=int(input())
c=int(input())
print(m+a+b+c)

多组输入

while True:
try:
print sum(map(int,raw_input().split()))
except:
break

python 实现加法的更多相关文章

  1. python 列表加法"+"和"extend"的区别

    相同点 : "+"和"extend"都能将两个列表成员拼接到到一起 不同点 :   + : 生成的是一个新列表(id改变) extend : 是将一个列表的成员 ...

  2. python 用加法实现a,b两数相乘

    """思路:1.a * b = a + a + a + ... 2.a * b = n个a相加,只需求证b = n即可 3.用for 循环遍历即可,b就是range的最大 ...

  3. python 二进制加法

    bin(int(a,2)+int(b,2))[2:]

  4. python 列表加法"+"和"extend"的区别

    相同点 : "+"和"extend"都能将两个列表成员拼接到到一起 不同点 :   + : 生成的是一个新列表(id改变) extend : 是将一个列表的成员 ...

  5. python成长之路——第一天

    一.python版本间的差异: 1.1:2.x与3.x版本对比 version 2.x 3.x print print " "或者print()打印都可以正常输出 只能print( ...

  6. 为什么python运行的慢

    最近在leetcode刷题,明显的注意到同样的算法,python运行的要慢的多,查资料得到python运行的慢主要原因如下: 一.动态类型导致运行速度慢,在北邮人论坛里面的这篇帖子中有较为详细的解释, ...

  7. python基础教程总结6——类

    1. 如何定义一个类 在进行python面向对象编程之前,先来了解几个术语:类,类对象,实例对象,属性,函数和方法. 类是对现实世界中一些事物的封装,定义一个类可以采用下面的方式来定义: class  ...

  8. Python-面向对象 (二 继承)

    一 继承   基类定义例如以下: class people:     #define attribute     name = ''     age  = 0     #define private ...

  9. str函数之不同变量之间如何连接,外加浮点运算注意事项

    最近看书了解到不同字符串之间可以用“+”号来连接,遂思考如何将不同变量连接起来,思考试验并上网查询后得出了结果,在此将所学分享给在阅读的各位. 数据类型的转换   常识可知,在python中,不同的数 ...

随机推荐

  1. goland使用:导入一个github开源项目tidb

    概要:在windos下的IDEA 的go语言的编辑器 goland的使用,导入github上面的开源项目. 问题: 下载好goland之后,open project打开一个下载好的githubhub项 ...

  2. javaweb各种框架组合案例(七):springboot+jdbcTemplete+通用dao+restful

    一.介绍 1.springboot是spring项目的总结+整合 当我们搭smm,ssh,ssjdbc等组合框架时,各种配置不胜其烦,不仅是配置问题,在添加各种依赖时也是让人头疼,关键有些jar包之间 ...

  3. 关于windows服务器配置

    #我是用的window service2008系统,在配置服务器时由于是用php进行搭建 #首先我安装好phpstudy,通过服务器ip访问,显示了个helloworld,我查看了phpstudy里的 ...

  4. HTML5 Canvas(实战:绘制饼图2 Tooltip)

    继上一篇HTML5 Canvas(实战:绘制饼图)之后,笔者研究了一下如何给饼图加鼠标停留时显示的提示框. Plot对象 在开始Coding之前,笔者能够想到的最easy的方式,就是给饼图的每一个区域 ...

  5. 前端每日实战:37# 视频演示如何把握好 transition 和 animation 的时序,创作描边按钮特效

    效果预览 按下右侧的"点击预览"按钮可以在当前页面预览,点击链接可以全屏预览. https://codepen.io/comehope/pen/mKdzZM 可交互视频教程 此视频 ...

  6. django classonlymethod 和 python classmethod的区别

    --classmethod可以被一个实例调用,classonlyethod只能被类调用 class Kls(object): no_inst = 0 def __init__(self): Kls.n ...

  7. macOS gcc g++ c++ cc

    安装完Xcode之后,系统中默认的编译器不再是Gcc系列,编译一些库的时候经常产生问题. 在PATH变量中设置symbol link,把gcc,g++,c++,cc全链接到Gcc系列.

  8. LeetCode--054--区螺旋矩阵(java)

    给定一个包含 m x n 个元素的矩阵(m 行, n 列),请按照顺时针螺旋顺序,返回矩阵中的所有元素. 示例 1: 输入: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ...

  9. 用树状数组写的最长上升子序列(友好城市),nlogn。

    #include<iostream> #include<algorithm> #define maxn 100000 #define lb(x) x&-x using ...

  10. stack2链栈

    #include<iostream> using namespace std; template <class Object> class Stack{ private: st ...