Double Strings Solved Problem code: DOUBLE
# Fuking silly, OTZ.... import sys def main():
n = int(raw_input()) for num in sys.stdin:
if int(num) % 2 == 0:
print int(num)
else: # 千万不要忘了考虑奇数的情况
print int(num) -1 main()
学习
化繁为简
逻辑上的理解正确和化繁为简,是刷OJ的第一步,比如本题,一堆废话,其实水爆
输入缓冲流
stdin这种输入就是缓冲流的使用
判断奇偶
模2
错误
奇数
注意题目中的数据input,明显是包含奇数的
Double Strings Solved Problem code: DOUBLE的更多相关文章
- Factorial Solved Problem code: FCTRL
import sys #import psyco #很奇怪,这题用psyco就runtime error #psyco.full() def z(n): #这个应该是技巧的一种算法 r = 0 whi ...
- ATM Solved Problem code: HS08TES
# ATM import sys withdraw, balance = map(float, sys.stdin.readline().strip().split()) # strip()用法去除结 ...
- Small factorials Solved Problem code: FCTRL2
import sys def fact(n): final = n while n > 1: final *= n - 1 n -= 1 return final #逻辑严谨,不要忘了retur ...
- Enormous Input Test Solved Problem code: INTEST
import sys import psyco #一键优化库 psyco.full() def main(): n, k = map(int, sys.stdin.readline().strip() ...
- [转]Passing Managed Structures With Strings To Unmanaged Code Part 3
1. Introduction. 1.1 In part 1 of this series of blogs we studied how to pass a managed structure (w ...
- [转]Passing Managed Structures With Strings To Unmanaged Code Part 2
1. Introduction. 1.1 In part 1 of this series of blogs we studied how to pass a managed structure (w ...
- Cooking Schedule Problem Code: SCHEDULE(优先队列)
Cooking Schedule Problem Code: SCHEDULE Chef is a well-known chef, and everyone wishes to taste his ...
- Gym 101194E / UVALive 7901 - Ice Cream Tower - [数学+long double][2016 EC-Final Problem E]
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?opti ...
- CSU 1506 Problem D: Double Shortest Paths(最小费用最大流)
题意:2个人从1走到n,假设一条路第一次走则是价值di,假设第二次还走这条路则须要价值di+ai,要你输出2个人到达终点的最小价值! 太水了!一条边建2次就OK了.第一次价值为di,第二次为ai+di ...
随机推荐
- iTween_ValueTo函数
ValueTo:返回一个插值在两件值之间的值供回调函数使用; 网上没找到例子,自己试了下,直接看代码就明白了. , 0, 0),// gameObject.transform.position为0.0 ...
- 手绘经典QQ头像 请让我一个人呆一会
- Leetcode_Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were ...
- 简单工厂模式 - OK
简单工厂模式是由一个工厂对象决定创建出哪一种产品类的实例.简单工厂模式是工厂模式家族中最简单实用的模式,可以理解为是不同工厂模式的一个特殊实现. 使用场景: 工厂类负责创建的对象比较少: 客户只知道传 ...
- mysql创建utf-8字符集数据库
CREATE DATABASE db_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE DATABASE 的语法:CREA ...
- BZOJ1638: [Usaco2007 Mar]Cow Traffic 奶牛交通
1638: [Usaco2007 Mar]Cow Traffic 奶牛交通 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 571 Solved: 199 ...
- android 通过TimePickerDialog修改时间
初学android,写了个修改时间的小程序,实现如下: 点击change按钮,弹出时间对话框: 然后点击Done,设置显示时间: 实现方式有两种, 一种是使用showDialog方法,不过此种方法已过 ...
- VS2013中C++创建DLL导出class类
1.创建"Win32 Console Application"项目,命名为"ClassDllLib",并在"Application type" ...
- Kuhn-Munkres算法。带权二分图匹配模板 (bin神小改版本)
/****************************************************** 二分图最佳匹配 (kuhn munkras 算法 O(m*m*n)). 邻接矩阵形式 . ...
- 从有限状态机的角度去理解Knuth-Morris-Pratt Algorithm(又叫KMP算法)
转载请加上:http://www.cnblogs.com/courtier/p/4273193.html 在开始讲这个文章前的唠叨话: 1:首先,在阅读此篇文章之前,你至少要了解过,什么是有限状态机, ...