ZOJ1969-Hard to Believe, but True!
import re
while True:
x = raw_input()
if(x == '0+0=0'):
print 'True'
break
a,b,c = re.split('[+=]', x)
[a,b,c] = [int(''.join(list(x)[::-1])) for x in [a,b,c]]
if(a+b == c):
print 'True'
else:
print 'False'
额,判断一个算式是否符合她的加法规则,
比如73+42=16.
如果37+24 == 61,,那么就符合了,,这里用到正则分割字符串,,字符串到list然后切片再join到字符串然后转化到int,,不知道有没有更好的写法..
ZOJ1969-Hard to Believe, but True!的更多相关文章
- php使用microtime(true)查看代码执行时间
microtime() 函数返回当前 Unix 时间戳和微秒数. 如果带个 true 参数, 返回的将是一个浮点类型 round() 取出小数点后 3 位 $t1 = microtime(true); ...
- JS中字符串的true转化为boolean类型的true
var a="True"; a = eval(a.toLowerCase()); alert(typeof a); //boolean alert(a);//true 正解,eva ...
- 继承 原生js 与 $.extend(true,default,opts||{});
$.extend(true,default,opts||{}); var obj1={ name:'liu', sex:'m', work:'pc' } var obj2={ sex:'w' } va ...
- IOS中div contenteditable=true无法输入
在IOS中<div contenteditable="true"></div>中点击时可以弹出键盘但是无法输入.加一个样式-webkit-user-sele ...
- <%@ page trimDirectiveWhitespaces="true" %>
我们经常会在JSP页面上使用: <%@ page trimDirectiveWhitespaces="true" %> 这个命令可以使jsp输出的html时去除多余的空 ...
- mysql 数据库连接超时的问题 autoReconnect=true
最近在使用spring-jdbc数据库连接管理时,出现一个奇怪问题,当天部署运行没问题,第二天再试就报以下异常问题 org.springframework.dao.RecoverableDataAcc ...
- jsp include flush true
设置flush为true,就是说,如果你的缓冲区的内容很多了,就将数据读出,以免数据泄漏,造成错误服务器端页面缓冲,大致的意思是,在将生成的HTML代码送到客户端前,先在服务器端内存中保留,因为解释J ...
- allow zero datetime=true导致datetime转换失败:MySql.Data.Types.MySqlDateTime”的对象无法转换为类型“System.Nullable`1[System.DateTime]
allow zero datetime=true导致datetime转换失败:MySql.Data.Types.MySqlDateTime”的对象无法转换为类型“System.Nullable`1[S ...
- druid sql黑名单 报异常 sql injection violation, part alway true condition not allow
最近使用druid,发现阿里这个连接池 真的很好用,可以监控到连接池活跃连接数 开辟到多少个连接数 关闭了多少个,对于我在项目中查看错误 问题,很有帮助, 但是最近发现里面 有条sql语句 被拦截了, ...
- jqGrid的autoencode参数设置为true在客户端可能引发的编码问题
不久前使用jqGrid+MVC做过一段时间开发. 一开始,分页参数几乎都是默认值,jqGrid的分页功能很好用. 考虑到each input is evil,我们的系统对安全性又有较高要求,所以,为了 ...
随机推荐
- Display PowerPoint slide show within a VB form or control window
The example below shows how to use VB form/control as a container application to display a PowerPoin ...
- HDU 1203 背包问题
题目大意: 根据学校的申请费用,根据已有的钱得到最大的offer率 这里很明显就是一个价值为概率的背包问题 计算两个offer合并的概率 为a + b - a*b #include <cstdi ...
- 【GC概述以及查看堆内存使用】Java内存管理和GC学习
内存划分 1.JAVA内存主要划分为方法栈.方法区.堆. 2.方法栈上内存会自动释放: 3.方法区上主要加载了类的元信息.静态变量.常量.改区域又称为持久代(Perm Gen),默认是最小16M,最大 ...
- SQLalchemy 查询总结
#简单查询 print(session.query(User).all()) print(session.query(User.name, User.fullname).all()) print(se ...
- ci 传参
ci框架 方法上传参 public function index($cataid,$payeid,$per){ echo $cataid; echo $payeid; echo $per; } 直接就 ...
- python supervisor进程监控工具的使用
supervisor —— a process control system 另外一个类似 supervisor的工具,因为supervisor 不兼容python3, !!! Circus Proc ...
- 1.3-动态路由协议EIGRP
EIGRP(Enhanced IGRP) EIGRP的特点: IGRP/EIGRP都是CISCO的私有协议. 1:是唯一的一种LS/DV的混合协议. 2:Rapid convergence EIGRP ...
- ubuntu tweak Install
ubuntu tweak 1:增加PPA源 sudo add-apt-repository ppa:tualatrix/ppa 2:編輯源列表sudo gedit /etc/apt/sources.l ...
- 【Cocos2dx游戏开发】CCNotificationCenter传递消息和数据
在开发游戏的时候我们经常需要在层与层之间.场景与场景之间传递数据和消息,Cocos2dx框架应用观察者模式为我们封装了一个CCNotificationCenter类,也叫消息通知中心,它也是一个单例类 ...
- 读写Word的组件DocX介绍与入门
本文为转载内容: 文章原地址:http://www.cnblogs.com/asxinyu/archive/2013/02/22/2921861.html 开源Word读写组件DocX介绍与入门 阅读 ...