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. MySQL 存储过程与事物

    一:存储过程    存储过程可以说是一个记录集吧,它是由一些T-SQL语句组成的代码块,这些T-SQL语句代码像一个方法一样实现一些功能     存储过程的好处:   1.由于数据库执行动作时,是先编 ...

  2. [转] Mongoose简要API

    Mongoose是在node.js环境下对mongodb进行便捷操作的对象模型工具 因此,要使用mongoose,则必须安装node.js环境以及mongodb数据库.mongoose使mongodb ...

  3. Java基础知识➣网络Socket(六)

    概述 网络编程是指编写运行在多个设备(计算机)的程序,这些设备都通过网络连接起来. java.net 包中提供了两种常见的网络协议的支持: TCP:TCP 是传输控制协议的缩写,它保障了两个应用程序之 ...

  4. T37302 P哥的桶

    题解: 比较简单的一道题 线段树+线性基 显然离线处理出位置 然后线段树updata的时候暴力合并线性基 nlogn^3 一个常数优化就是线性基已满就直接返回这个线性基 还有个优化是用快速找到第一个1 ...

  5. 【转】android:paddingLeft与android:layout_marginLeft的区别

    http://www.blogjava.net/anchor110/articles/342206.html 当按钮分别设置以上两个属性时,得到的效果是不一样的. android:paddingLef ...

  6. centos中less翻页查询的用法

    用法实例: cat 21342.log | less

  7. Codeforces 915G Coprime Arrays 莫比乌斯反演 (看题解)

    Coprime Arrays 啊,我感觉我更本不会莫比乌斯啊啊啊, 感觉每次都学不会, 我好菜啊. #include<bits/stdc++.h> #define LL long long ...

  8. Python re模块, xpath 用法

    1.re正则的用法总结 (1). ^ 表示以哪个字符为开头      eg:  '^g' 表示以g开头的字符串      . 表示任意字符 '^g.d'  表示以g开头第二个为任意字符,第三个为b的字 ...

  9. 给定数组长度2n,分成n对,求n对最小元素之和最大

    给定长度为 2n 的数组, 你的任务是将这些数分成 n 对, 例如 (a1, b1), (a2, b2), ..., (an, bn) ,使得从1 到 n 的 min(ai, bi) 总和最大. 示例 ...

  10. Badboy录制Jmter脚本

    提纲 1.特性和用途 2.下载和安装 3.界面介绍 4.录制脚本(注意:badboy默认是打开就开始录制,需要在step双击后进行取消默认设置) 5.添加断言(参数化设置,注意:badboy默认只运行 ...