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 查询结果中增加序号

    ) as rownum,person_id from t_base_person

  2. javaScript事件(八)事件类型之变动事件

    DOM2级的变动(mutation)事件能在DOM中某一部分发送变化时给出提示.变动事件为XML或HTML DOM设计的,并不特定于某种语言.DOM2级定义了如下变动事件. DOMSubtreeMod ...

  3. 精简版自定义 jquery

    function $(id) { var el = 'string' == typeof id ? document.getElementById(id) : id; el.on = function ...

  4. appstore跳转

    二维码跳转 https://itunes.apple.com/cn/app/id123123123 应用内跳转 this.alertCtrl.create({ title: '更新', message ...

  5. python_异常处理_断言

    一.Python标准异常 常用异常 Exception 常规错误的基类 AttributeError 试图访问一个对象没有的属性 IOError 输入/ 输出异常,基本上是无法打开文件 ImportE ...

  6. Python_列表常用操作

    %d   数字 %f    浮点 %s    字符串 字符串常用功能: .strip()   默认去掉字符串两边空格#或者在括号里注明去除什么 查看列表方法:dir(列表名) .append(元素): ...

  7. ssh连接时提示THE AUTHENTICITY OF HOST XX CAN’T BE ESTABLISHED

    ssh链接云主机: ssh root@123.59.xx.xx 报错:THE AUTHENTICITY OF HOST XX CAN’T BE ESTABLISHED 解决办法: ssh -o Str ...

  8. python的random()函数

    python 的random函数需要调用 #!/usr/bin/python # -*- coding: UTF-8 -*- import random print( random.randint(1 ...

  9. LOJ#6433. 「PKUSC2018」最大前缀和 状压dp

    原文链接https://www.cnblogs.com/zhouzhendong/p/LOJ6433.html 题解 枚举一个集合 S ,表示最大前缀和中包含的元素集为 S ,然后求出有多少个排列是这 ...

  10. Azkaban

    Azkaban安装部署 https://azkaban.github.io/azkaban/docs/2.5/ 安装Azkaban ) 在/opt/module/目录下创建azkaban目录 [kri ...