python 2.7,用来熟悉Python

由于都是智障题,所以我也不讲述题意和题解,直接贴代码了……

A

import sys
h,m = map(int,raw_input().split(":"))
ans = 0
while True:
if h%10 == m/10 and h/10 == m%10:
break
ans = ans + 1
h,m = (h+m/59)%24,(m+1)%60
print ans

B

import sys
maxn = 200005
# class bit:
# def __init__(self):
# self.a = []
# for i in xrange(maxn):
# self.a.append(0)
# def lowbit(self,x):
# return x&(-x)
# def update(self,x,y):
# i=x
# while i < maxn:
# self.a[i] += y
# i+=self.lowbit(i)
# def get(self,x):
# ans=0
# i=x
# while i > 0:
# ans=ans+self.a[i]
# i-=self.lowbit(i)
# return ans
b = [0]*maxn
l = [0]*maxn
# Bit = bit()
n,k,m= map(int,raw_input().split())
for i in range(0,n):
a,b=map(int,raw_input().split())
l[a]=l[a]+1
l[b+1]=l[b+1]-1
tmp=0
ans=[0]
for i in range(1,maxn):
tmp=tmp+l[i]
ans2=0
if tmp >= k:
ans2=1
ans.append(ans2)
ans[i]=ans[i]+ans[i-1]
for i in range(0,m):
a,b=map(int,raw_input().split())
print ans[b]-ans[a-1]

C

import sys
def read():
return map(int,raw_input().split())
n,m=read()
g=[list(read()) for i in range(n)]
a=[g[i][0]-g[0][0] for i in range(n)]
b=[g[0][i]-g[0][0] for i in range(m)]
for i in range(n):
for j in range(1,m):
if g[i][j] - g[i][0] != b[j]:
print "-1"
exit()
for j in range(m):
for i in range(1,n):
if g[i][j] - g[0][j] != a[i]:
print "-1"
exit()
mn=min(min(i) for i in g)
mb=min(b)
for i in range(m):
b[i]-=mb
ma=min(a)
for i in range(n):
a[i]-=ma
if n<m:
for i in range(n):a[i]+=mn
else:
for i in range(m):b[i]+=mn
print(sum(a)+sum(b))
for i in range(n):
for j in range(a[i]):
print "row",i+1
for i in range(m):
for j in range(b[i]):
print "col",i+1

Codeforces Round #419 (Div. 2) ABC的更多相关文章

  1. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  2. Codeforces Round #247 (Div. 2) ABC

    Codeforces Round #247 (Div. 2) http://codeforces.com/contest/431  代码均已投放:https://github.com/illuz/Wa ...

  3. Codeforces Round #419 (Div. 2) E. Karen and Supermarket(树形dp)

    http://codeforces.com/contest/816/problem/E 题意: 去超市买东西,共有m块钱,每件商品有优惠卷可用,前提是xi商品的优惠券被用.问最多能买多少件商品? 思路 ...

  4. Codeforces Round #419 (Div. 2) B. Karen and Coffee(经典前缀和)

    http://codeforces.com/contest/816/problem/B To stay woke and attentive during classes, Karen needs s ...

  5. Codeforces Round #419 (Div. 2) A. Karen and Morning(模拟)

    http://codeforces.com/contest/816/problem/A 题意: 给出一个时间,问最少过多少时间后是回文串. 思路: 模拟,先把小时的逆串计算出来: ① 如果逆串=分钟, ...

  6. Codeforces Round #313 (Div. 2) ABC

    A http://codeforces.com/contest/560/problem/A 推断给出的数能否组成全部自然数. 水题 int a[1010]; bool b[1000010]; int ...

  7. Codeforces Round #312 (Div. 2) ABC题解

    [比赛链接]click here~~ A. Lala Land and Apple Trees: [题意]: AMR住在拉拉土地. 拉拉土地是一个很漂亮的国家,位于坐标线.拉拉土地是与著名的苹果树越来 ...

  8. Codeforces Round #419 (Div. 2)

    1.题目A:Karen and Morning 题意: 给出hh:mm格式的时间,问至少经过多少分钟后,该时刻为回文字符串? 思路: 简单模拟,从当前时刻开始,如果hh的回文rh等于mm则停止累计.否 ...

  9. Codeforces Round #419 Div. 1

    A:暴力枚举第一列加多少次,显然这样能确定一种方案. #include<iostream> #include<cstdio> #include<cmath> #in ...

随机推荐

  1. TagCanvas 插件

    TagCanvas是一个基于HTML5 Canvas技术开发的标签云动画.还提供一个以jQuery插件形式实现的版本. 它支持文本和图片两种格式,能够以Sphere, hcylinder 或 vcyl ...

  2. 学习笔记: IO操作及序列化

    /// <summary> /// 文件夹  文件管理 /// </summary> public class MyIO {     /// <summary>   ...

  3. Ansible playbook 部署filebeat

    - hosts: all tasks: - name: Copy Package copy: src=/usr/local/filebeat--linux-x86_64.tar.gz dest=/us ...

  4. Lambda表达式树解析(下)

    概述 前面章节,总结了Lambda树的构建,那么怎么解析Lambda表达式树那?Lambda表达式是一种委托构造而成,如果能够清晰的解析Lambda表达式树,那么就能够理解Lambda表达式要传递的正 ...

  5. 【bzoj4887】[Tjoi2017]可乐 矩阵乘法

    题解: 比较简单的一道题目 如果会倍增floyd这个就很显然的 每次转移看成乘上一个矩阵 另外自爆等同于连到一个特殊点,特殊点只能走自己 停留就是增加自环

  6. Codeforces 513E2 Subarray Cuts dp (看题解)

    我们肯定要一大一小间隔开来所以 把式子拆出来就是类似这样的形式 s1 - 2 * s2 + 2 * s3 + ...... + sn 然后把状态开成四个, 分别表示在顶部, 在底部, 在顶部到底部的中 ...

  7. Codeforces 109D String Transformation 字符串 哈希 KMP

    原文链接https://www.cnblogs.com/zhouzhendong/p/CF109D.html 题目传送门 - CF109D 题意 给定两个字符串 $a,b$ ,求一组 $i,j$ 使得 ...

  8. P1233 木棍加工 dp LIS

    题目描述 一堆木头棍子共有n根,每根棍子的长度和宽度都是已知的.棍子可以被一台机器一个接一个地加工.机器处理一根棍子之前需要准备时间.准备时间是这样定义的: 第一根棍子的准备时间为1分钟: 如果刚处理 ...

  9. 最接近的三数之和(给定一个包括 n 个整数的数组 nums 和 一个目标值 target。找出 nums 中的三个整数, 使得它们的和与 target 最接近。返回这三个数的和)

    例如,给定数组 nums = [-1,2,1,-4], 和 target = 1. 与 target 最接近的三个数的和为 2. (-1 + 2 + 1 = 2). 思路:首先对数组进行排序     ...

  10. servlet生命周期和工作原理

    http://www.cnblogs.com/cuiliang/archive/2011/10/21/2220671.html