python程序的输入输出(acm的几个小程序)
1, A+B Problem : http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1000
#!/usr/bin/env python
# coding=utf-8 a=[] for x in raw_input().split():
a.append(int(x)) print sum(a)
2, A+B for Input-Output Practice (I) : http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1010
while True:
a=[]
line = raw_input()
if line:
for x in line.split():
a.append(int(x))
print sum(a)
else:
break
3, A+B for Input-Output Practice (II) : http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1011
#!/usr/bin/env python
#coding:utf8 t = int(raw_input()) while t>0:
a=[]
for x in raw_input().split():
a.append(int(x))
print sum(a)
t=t-1
4, A+B for Input-Output Practice (III) : http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1012
#!/usr/bin/env python
#coding:utf8 while True:
line = raw_input()
a=[]
for x in line.split():
a.append(int(x))
if a[0]==0 and a[1]==0:
break
print sum(a)
5, A+B for Input-Output Practice (IV) : http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1013
#!/usr/bin/env python
#coding:utf8 while True:
num=[]
line = raw_input()
for x in line.split():
num.append(int(x))
if num[0]==0:
break
a=num[0]
print sum(num)-a
6, A+B for Input-Output Practice (V) : http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1014
#!/usr/bin/env python
#coding:utf8 t = int(raw_input()) while t>0:
if t==0:
break
line = raw_input()
num=[]
for x in line.split():
num.append(int(x))
print sum(num)-num[0]
t = t-1
7, A+B for Input-Output Practice (VI) : http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1015
#!/usr/bin/env python
#coding:utf8 while True:
line = raw_input()
num=[]
for x in line.split():
num.append(int(x))
print sum(num)-num[0]
8, A+B for Input-Output Practice (VII) : http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1016
被打败了,被'\r'打败了,,输出一个空行,,不解释
#!/usr/bin/env python
#coding:utf8 while True:
a=[]
line = raw_input()
for x in line.split():
a.append(int(x))
print sum(a)
print '\r' #输出一个空行
附 : python转义字符:
在需要在字符中使用特殊字符时,python用反斜杠(\)转义字符。如下表:
| 转义字符 | 描述 |
|---|---|
| \(在行尾时) | 续行符 |
| \\ | 反斜杠符号 |
| \' | 单引号 |
| \" | 双引号 |
| \a | 响铃 |
| \b | 退格(Backspace) |
| \e | 转义 |
| \000 | 空 |
| \n | 换行 |
| \v | 纵向制表符 |
| \t | 横向制表符 |
| \r | 回车 |
| \f | 换页 |
| \oyy | 八进制数yy代表的字符,例如:\o12代表换行 |
| \xyy | 十进制数yy代表的字符,例如:\x0a代表换行 |
| \other | 其它的字符以普通格式输出 |
#!/usr/bin/env python
#coding:utf8 t = int(raw_input()) while t>0:
line = raw_input()
num = []
for x in line.split():
num.append(int(x))
print sum(num)-num[0]
t = t-1
if t!=0:
print '\r'
python程序的输入输出(acm的几个小程序)的更多相关文章
- 微信小程序如何跳转到另一个小程序
微信小程序如何跳转到另一个小程序,要注意:在app.json文件里也要配置 navigateToMiniProgramAppIdList,如下图: "navigateToMiniProgra ...
- 【微信小程序推广营销】教你微信小程序SEO优化,让你的小程序快人一步抢占先机
今年一月份上线的小程序,经过近一年的沉淀发酵,现在也进入了快速发展期. 在未来肯定会有越来越多的小程序诞生,小程序多了就需要搜索,那么如何让自己的小程序在众多的小程序中脱颖而出,这就需要小程序SEO优 ...
- [转]微信小程序之购物数量加减 —— 微信小程序实战商城系列(3)
本文转自:http://blog.csdn.net/michael_ouyang/article/details/70194144 我们在购买宝贝的时候,购物的数量,经常是我们需要使用的,如下所示: ...
- 小程序:位置信息(Location)及微信小程序LBS解决方案实践
目前在做的小程序需要使用到map组件以及小程序个性地图,涉及到的功能如下: 1# 获取用户当前位置,返回对应的省市区 2# 根据目的地的具体地址,显示在地图中的位置 3# 根据用户当前位置,计算出 与 ...
- 小程序开发运营必看:微信小程序平台运营规范
一.原则及相关说明 微信最核心的价值,就是连接——提供一对一.一对多和多对多的连接方式,从而实现人与人.人与智能终端.人与社交化娱乐.人与硬件设备的连接,同时连接服务.资讯.商业. 微信团队一 ...
- 微信小程序开发:学习笔记[7]——理解小程序的宿主环境
微信小程序开发:学习笔记[7]——理解小程序的宿主环境 渲染层与逻辑层 小程序的运行环境分成渲染层和逻辑层. 程序构造器
- [技术博客]微信小程序审核的注意事项及企业版小程序的申请流程
关于小程序审核及企业版小程序申请的一些问题 微信小程序是一个非常方便的平台.由于微信小程序可以通过微信直接进入,不需要下载,且可使用微信账号直接登录,因此具有巨大的流量优势.但是,也正是因为微信流量巨 ...
- 小程序的组件插槽使用slot===以及小程序多个插槽使用方法 三步骤
===================== 小程序多个插槽使用方法 三步骤 小程序多个插槽第一步 小程序组件内使用多个插槽第二部 小程序使用多个插槽第三部
- 跟风微信小程序,生鲜水果店如何借力小程序每天多赚2万块?
公司旁边的水果店,虽然是一家实体店,但老板有一颗爱玩互联网的心. 老板非常重视线上的营销推广,什么新的线上推广方式都爱尝试一下.公众号大热时做了自己的微信公众号,并且有自己的微信商城,不过线上的销售一 ...
- mPaaS 小程序架构解析 | 实操演示小程序如何实现多端开发
对于 mPaaS 小程序开发框架,想必读者们并不陌生.它源自于支付宝小程序框架,继承了易开发性.跨平台性及 Native 性能,不仅帮助开发者实现面向自有 App 投放小程序,还可快速构建打包,覆盖支 ...
随机推荐
- visual c++中预定义的宏
一.主要目标 (由于visual studio通常包含很多开发环境,通常将其中c/c++的ide称为visual c++ 20xx) 整理下visual c++ 2010下预定义的宏.做一下备忘和了解 ...
- 在PL/SQL中调用存储过程--oracle
在oracle10中写好了存储过程,代码如下: CREATE OR REPLACE Procedure Proc_Insert ( sName in varchar2, sAge in int, sE ...
- Lintcode: Kth Largest Element 解题报告
Kth Largest Element Find K-th largest element in an array. Note You can swap elements in the array E ...
- 【Tensorflow】设置显存自适应,显存比例
用惯了theano.再用tensoflow发现一运行显存就满载了,吓得我吃了一个苹果. 用天朝搜索引擎毛都搜不到,于是FQ找了下问题的解决方法,原来有两种 按比例 config = tf.Config ...
- Machine Learning、Date Mining、IR&NLP 会议期刊论文推荐
核心期刊排名查询 http://portal.core.edu.au/conf-ranks/ http://portal.core.edu.au/jnl-ranks/ 1.机器学习推荐会议 ICML— ...
- LVS之NAT模型、DR模型配置和持久连接
前言:继LVS概述,本篇实现NAT模型和DR模型下的负载均衡. NAT模型: LVS-NAT基于cisco的LocalDirector.VS/NAT不需要在RealServer上做任何设置,其只要能提 ...
- 审计一波appcms-持续更新。
废话 看到土司大牛都在审计,作为彩笔也要审计下去.该文章置顶持续更新.大家有啥可以评论区交流. 先对其目录进行分析 -admin/ #后台文件 - - -cache/ #缓存目录 -core/ #核心 ...
- swift,NSUserDefaults的swift化封装
NSUserDefaultshtml, body {overflow-x: initial !important;}.CodeMirror { height: auto; } .CodeMirror- ...
- [uboot]uboot中run的一些command在源码位置
如在uEnv.txt中, loadfdt=fatload mmc ${mmcdev}: ${fdtaddr} ${fdtfile} fdtboot=run mmc_args; bootz ${load ...
- [开发笔记]-Linq to xml学习笔记
最近需要用到操作xml文档的方法,学习了一下linq to xml,特此记录. 测试代码: class Program { //参考: LINQ to XML 编程基础 - luckdv - 博客园 ...