The Lead Game Add problem to Todo list Problem code: TLG
'''def count_lead(first, second):
if first > second:
return 1, first - second
elif first == second: # 题目中没有说明相等的情况
return 0, 0
else:
return 2, second - first''' def main():
n = int(raw_input())
lead = 0
winner = 0 # 有些初始值不放置,判断不成立而输出时,为空了就
num1 = 0
num2 = 0
while n > 0:
first, second = map(int, raw_input().split())
if abs(first-second) > lead: # 绝对值函数
lead = abs(first-second)
num1 += first
num2 += second
n -= 1 print num1, num2
if num1 > num2: # 这个地方题目有歧义,总分赢还是分局赢
winner = 1
else:
winner = 2 print "%d %d" % (winner, lead) # 注意满足题目输出的的格式要求,int整数 main()
http://www.codechef.com/problems/TLG
学习
The Lead Game Add problem to Todo list Problem code: TLG的更多相关文章
- Holes in the text Add problem to Todo list Problem code: HOLES
import sys def count_holes(letter): hole_2 = ['A', 'D', 'O', 'P', 'Q', 'R'] if letter == 'B': return ...
- Turbo Sort Add problem to Todo list Problem code: TSORT
def heap_sort(ary): n = len(ary) first = int(n / 2 - 1) for start in range(first, -1, -1): # 3~0 rev ...
- Problem : 1002 ( A + B Problem II )
经验总结:一定要注意输出的格式,字符的空格,空行,一定要观察清楚.如本题的最后一个输出结果后面没有空行.最后代码实现的时候需要判断一下,代码如下 !=n) cout<<endl; Prob ...
- 2013-2014 ACM-ICPC, NEERC, Southern Subregional Contest Problem B. Travelling Camera Problem set贪心
Problem B. Travelling Camera Problem 题目连接: http://www.codeforces.com/gym/100253 Description Programm ...
- Problem B The Blocks Problem(vector的使用)
题目链接:Problem B 题意:有n块木块,编号为0~n-1,要求模拟以下4种操作(下面的a和b都是木块编号) 1. move a onto b: 把a和b上方的木块全部归位,然后把a摞在b上面. ...
- 几何入门合集 gym101968 problem F. Mirror + gym102082 Problem F Fair Chocolate-Cutting + gym101915 problem B. Ali and Wi-Fi
abstract: V const & a 加速 F. Mirror 题意 链接 问题: 有n个人在y=0的平面上(及xoz平面).z=0平面上有一面镜子(边平行于坐标轴).z=a平面上有q个 ...
- A+B Problem Plus and A-B Problem Plus and A*B Problem Plus
//we have defined the necessary header files here for this problem. //If additional header files are ...
- Problem J. Joseph’s Problem 约瑟夫问题--余数之和
链接:https://vjudge.net/problem/UVA-1363 题意:给出n k,当 i 属于 1~n 时 ,求解 n% i 的和 n 和 k 的范围都是 1 到 10^9; 商相同 ...
- POJ - Problem 2282 - The Counting Problem
整体思路:对于每一位,先将当前未达到$limit$部分的段 [如 $0$ ~ $10000$] 直接处理好,到下一位时再处理达到$limit$的部分. · $1 × 10 ^ n$以内每个数(包括$0 ...
随机推荐
- ubuntu安装过程未设置root密码
- GO实例3 Slice append打印
package main import "fmt" func main(){ ]int slice:=array[:] slice[]='a' slice[]='b' s1:=ap ...
- iOS 第三方 需要 引用的库
================================================== AFNetWorking 是基于 nsurlconnection 所以不需要引入库 === ...
- jquery easyui二次开发总结(二)
1.easyui tab增加“关闭所有页”.“关闭非当前页”功能. //tab增加“关闭所有页”和“关闭非当前页”的功能 $("#tabs").tabs({ onAdd:funct ...
- subTree
struct Tree() { int val; Tree *left, *right; Tree(int a): val(a), left(NULL), right(NULL){} } bool h ...
- 【转】Android中定时器的3种实现方法
原文网址:http://www.android-study.com/pingtaikaifa/508.html 在Android开发中,定时器一般有以下3种实现方法: 一.采用Handler与线程的s ...
- cf437A The Child and Homework
A. The Child and Homework time limit per test 1 second memory limit per test 256 megabytes input sta ...
- git术语解释staging,index,cache
当我在使用git的时候,有三个东西的出现,一度让我非常困扰,就如题所述,staging,index,和cache. 比如,当我阅读git官网提供的电子书<Pro Git>的时候,最初一章里 ...
- JAVA中运用数组的四种排序方法
JAVA中在运用数组进行排序功能时,一般有四种方法:快速排序法.冒泡法.选择排序法.插入排序法. 快速排序法主要是运用了Arrays中的一个方法Arrays.sort()实现. 冒泡法是运用遍历数组进 ...
- hibernate错题解析
01 Hibernate错题分析 解析: 此题目考查的是对Hibernate中交叉连接的理解.HQL支持SQL风格的交叉连接查询,交叉连接适用于两个类之间没有定义任何关联时.在where字句中,通 ...