Codeforces Round #419 (Div. 2) ABC
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的更多相关文章
- 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 ...
- Codeforces Round #247 (Div. 2) ABC
Codeforces Round #247 (Div. 2) http://codeforces.com/contest/431 代码均已投放:https://github.com/illuz/Wa ...
- Codeforces Round #419 (Div. 2) E. Karen and Supermarket(树形dp)
http://codeforces.com/contest/816/problem/E 题意: 去超市买东西,共有m块钱,每件商品有优惠卷可用,前提是xi商品的优惠券被用.问最多能买多少件商品? 思路 ...
- 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 ...
- Codeforces Round #419 (Div. 2) A. Karen and Morning(模拟)
http://codeforces.com/contest/816/problem/A 题意: 给出一个时间,问最少过多少时间后是回文串. 思路: 模拟,先把小时的逆串计算出来: ① 如果逆串=分钟, ...
- Codeforces Round #313 (Div. 2) ABC
A http://codeforces.com/contest/560/problem/A 推断给出的数能否组成全部自然数. 水题 int a[1010]; bool b[1000010]; int ...
- Codeforces Round #312 (Div. 2) ABC题解
[比赛链接]click here~~ A. Lala Land and Apple Trees: [题意]: AMR住在拉拉土地. 拉拉土地是一个很漂亮的国家,位于坐标线.拉拉土地是与著名的苹果树越来 ...
- Codeforces Round #419 (Div. 2)
1.题目A:Karen and Morning 题意: 给出hh:mm格式的时间,问至少经过多少分钟后,该时刻为回文字符串? 思路: 简单模拟,从当前时刻开始,如果hh的回文rh等于mm则停止累计.否 ...
- Codeforces Round #419 Div. 1
A:暴力枚举第一列加多少次,显然这样能确定一种方案. #include<iostream> #include<cstdio> #include<cmath> #in ...
随机推荐
- js 2017
JS面向对象 <script> function num(val) { return val * 8 } function Index(name, age) { this.name = n ...
- luogu P2742 【模板】二维凸包 / [USACO5.1]圈奶牛Fencing the Cows
题解: 二维凸包裸题 按照x坐标为第一关键字,y坐标为第二关键字排序 然后相邻判断叉积用单调队列搞过去 正反都做一次就好了 代码: #include <bits/stdc++.h> usi ...
- 【AtCoder】ARC075
ARC075 在省选前一天听说正式选手线画到省二,有了别的女选手,慌的一批,然后刷了一个ARC来稍微找回一点代码感觉 最后还是挂分了,不开心 果然水平退化老年加重啊 原题链接 C - Bugged 直 ...
- [转]Howto: 使用ImageBrush替换PictureMarkerSymbol以加强graphic显示性能
原文地址:http://support.esrichina-bj.cn/2009/0728/1007.html 文章编号 : 37033 软件: ArcGIS API for Microsoft Si ...
- BZOJ1095 [ZJOI2007]Hide 捉迷藏 动态点分治 堆
原文链接https://www.cnblogs.com/zhouzhendong/p/BZOJ1095.html 题目传送门 - BZOJ1095 题意 有 N 个点,每一个点是黑色或者白色,一开始所 ...
- netty05(netty的一些介绍)
netty的一些理论 netty是一个异步事件驱动的网络应用框架(NIO框架),所有IO操作都是异步非阻塞的,NIO是对IO的一个补充 用于开发客户端和服务器的通信(TCP/UDP)长短连接 nett ...
- 学习Spring必须了解的基础知识——回调机制
上面这张图如果能看得懂就能理解什么是回调机制: A对象在调用a()方法时会调用B对象的b()方法,b()方法必须能调用A对象的callback()方法. 谁白了:a()方法有B对象b()方法的引用,b ...
- SpringMVC-1-(简介及HelloWord)
首先我们来看一下servlet的处理请求的方式: 一:SpringMVC简介: 一)SpringMVC中的几个重要组件 1.DispatchServlet: 前端控制器,mvc模式中的c,是整个流程的 ...
- JAVA 关键字及其作用解释
1. 访问控制 1) private 私有的 private 关键字是访问控制修饰符,可以应用于类.方法或字段(在类中声明的变量). 只能在声明 private(内部)类.方法或字段的类中引用这些类. ...
- GUI:GUI的方式创建/训练/仿真/预测神经网络—Jason niu
(1)导入数据:点击最左底部Import 按钮 (2)创建模型network_Jason_niu:点击底部的New按钮 (3)设置参数并训练:点击底部的Open按钮 (4)仿真预测: 大功告成!