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. WCF+Autofac 实现构造函数依赖注入

    1.新建一个项目 2.要对WCF服务实现Autofac注入,需要实现2个接口,IInstanceProvider与IServiceBehavior,并让实现IServiceBehavior的类成为一个 ...

  2. Unable to locate package python-pip

    原文:https://blog.csdn.net/yyinhai/article/details/53056973 Ubuntu下执行apt install python-pip得到如下错误提示: R ...

  3. IDEA上创建 Maven SpringBoot项目发布到Tomcat

    概述 上篇记录了IDEA上创建Maven SpringBoot+mybatisplus+thymeleaf 项目,但是如何将SpringBoot发布到Tomcat,直接采用Maven 命令Clear- ...

  4. 用groovy脚本进行每日工作的自动化【groovy】

    我们可以用groovy编写日常的批处理脚本,类似windows下的bat或者unix下的shell.其具体的编写方式非常简单,比如我们想要执行一个dir的命令,只要编写一个test.groovy,其中 ...

  5. ionic2集成sdk后,连接超时的问题

    这几天在测试app的时候,偶尔会发现集成的好视通sdk在进入会议室的时候出现连接超时的问题,一直卡在‘正在获取版本信息’的页面,经反复测试后这种现象主要出现在点击返回按钮和退出登录按钮的时候会出现,也 ...

  6. Flink--sink到kafka

    package com.flink.DataStream import java.util.Properties import org.apache.flink.api.common.serializ ...

  7. Python学习(二十八)—— Django模板系统

    转载自http://www.cnblogs.com/liwenzhou/p/7931828.html Django模板系统 官方文档 一.常用语法 只需要记两种特殊符号: {{  }}和 {% %} ...

  8. scheduler 基本原理

    Quartz 任务调度的核心元素是 scheduler, trigger 和 job,其中 trigger 和 job 是任务调度的元数据, scheduler 是实际执行调度的控制器. 1.sche ...

  9. 在controller中将timestamp类型的数据通过toString()方法变成字符串

    然后在miniui里面将dateFormat="yyyy-MM-dd",变成想要的格式.

  10. poj 2528 Mayor’s posters 【离散化】+【线段树】

    <题目链接> 题目大意: 往一堵墙上贴海报,依次输出这些海报张贴的范围,这些海报能够相互覆盖,问最后能够看见几张海报? 解题分析: 由于是给出每张海报的区间,所以在这些区间内的很多点可能用 ...