Codeforces Round #420 (Div. 2) A B C
来源:互联网 发布:按键精灵安卓网络验证 编辑:程序博客网 时间:2024/06/07 00:23
A. Okabe and Future Gadget Laboratory
# Time : 2017-6-26 10:30# Auther : Anjone# URL : http://codeforces.com/contest/821/problem/An = int(input())arr = [ list(map(int,input().split())) for i in range(n)]for i in range(n):for j in range(n):if( arr[i][j] != 1):cnt = 0for k in range(n):for l in range(n):if(arr[i][k] + arr[l][j] == arr[i][j]):cnt += 1if(cnt == 0):print("No")exit(0)print ("Yes")
B. Okabe and Banana Trees
# Time : 2017-6-26 13:30# Auther : Anjone# URL : http://codeforces.com/contest/821/problem/B# 对于一个确定的y找到最大的x# x y# getsum ∑ ( ∑ (i+j) ) = (y+1)*(x+y)*(x+1)/2# i=0 j=0getsum = lambda x,y : ( y + 1 ) * ( x + y ) * (x+1) // 2m,b = map(int,input().split())ans = 0for i in range(b+1):x = (b-i)*mans = max(ans, getsum(x,i))print(ans)
C. Okabe and Boxes
# Time : 2017-6-26 14:30# Auther : Anjone# URL : http://codeforces.com/contest/821/problem/C# 题意 :模拟进栈出栈 要求出栈顺序需要递增# 思路 :保证当前栈顶元素为num,若不是更新栈排序#栈排序后 下次出栈时判断为空 出栈元素必有序ans = 0num = 1stack = []n = int(input())for i in range(2*n):s = input()if s.find("add") != -1:stack.append(int(s.split()[1]) )else:if len(stack) != 0 and stack[-1] != num:stack = []ans+=1if len(stack):stack.pop()num += 1print(ans)
阅读全文
0 0
- Codeforces Round #420 (Div. 2) A B C
- Codeforces Round #420 (Div. 2)(A+B)
- Codeforces Beta Round #95 (Div. 2) A B C E
- 【CodeForce】Codeforces Round #140 (Div. 2) A B C
- 【CodeForce】Codeforces Round #142 (Div. 2) A B C
- Codeforces Round #160 (Div. 2)——A,B,C
- Codeforces Round #177 (Div. 2)——A,B,C
- Codeforces Round #179 (Div. 2)A、B、C、D
- Codeforces Round #184 (Div. 2)——A,B,C
- Codeforces Round #185 (Div. 2)——A,B,C
- Codeforces Round #186 (Div. 2)——A,B,C
- Codeforces Round #186 (Div. 2)A、B、C、D、E
- Codeforces Round #190 (Div. 2) A B C
- Codeforces Round #196 (Div. 2) A,B,C
- Codeforces Round #202 (Div. 2) (A、B、C、D)
- Codeforces Round #211 (Div. 2)(A,B,C,D)
- Codeforces Round #218,#217 (Div. 2) A.B.C
- Codeforces Round #220 (Div. 2)(A,B,C,D)
- jquery.cookie.js 实现 登录时 记住我
- Android中的WakeLock
- PyDev操作
- JVM源码分析之synchronized实现
- linux makefile
- Codeforces Round #420 (Div. 2) A B C
- iOS数组排序简单介绍
- UNIX下IO模型分析
- 使用JDBC连接MySQL数据库并且完成增删改查完整代码
- 基于SpringCloud的分布式事务框架(LCN)
- 线性表顺序存储结构的操作
- Java 并发工具包 java.util.concurrent
- Jquery操作table
- css测验