蓝桥杯刷题--python-16

562. 壁画 - AcWing题库

T=int(input())

j=1

while(j<=T):

N = int(input())

a=input()

s = 0*(N+1)

求前戳和

for i in range(1, N + 1):

si = int(ai-1) + si - 1

枚举

区间

max_ = float('-inf')

k = (N + 2 - 1) // 2

for i in range(k, N + 1):

tmp_ = si - si - k

max_ = max(tmp_, max_)

print(f'Case #{j}: {max_}')

j += 1

4956. 冶炼金属 - AcWing题库

N=int(input())

V_min=float("-inf")

V_max=float("inf")

for _ in range(N):

A,B=map(int,input().split())

V_min=max(V_min,(A//(B+1))+1)

V_max=min(V_max,(A//B))

print(V_min,V_max)

N=int(input())

V_min=float("-inf")

V_max=float("inf")

def check(A,B):

l=1

r=10**9+1

while(l<r):

mid=l+r>>1

if (A//mid<=B):

r=mid

else:

l=mid+1

return r

for _ in range(N):

A,B=map(int,input().split())

V_min=max(V_min,check(A,B))

V_max=min(V_max,check(A,B-1)-1)

print(V_min,V_max)

相关推荐
天赐范式3 分钟前
天赐范式第181天:让耦合开始失稳——竞争耦合与线性失稳边界
python·数字生命·天赐范式·lyapunov指数·动态运行时·耦合失稳·laplacian矩阵
happylifetree30 分钟前
Python15:核心语法-数据存储与运算-字符串拼接
python
huisheng_qaq1 小时前
【Python基础篇-09】深入理解python的闭包与装饰器
python·闭包
编码者卢布2 小时前
【App Service 】WebJobs 多实例实验:谁在运行,什么时候运行?
开发语言·python
quantdash_cc2 小时前
Python 获取实时行情后如何进行批量筛选?从全市场快照到策略候选池
开发语言·python·数据分析·量化交易·股票数据·quantdash
小蜗 strong3 小时前
和电脑猜拳(随机程序应用)
服务器·前端·python
华研前沿标杆游学3 小时前
企业标杆游学|走进东莞OPPO总部✨探秘智造与品牌出海
python
大侠归来4 小时前
C语言内存管理:从栈到堆的完整指南
c语言·开发语言·python
LOVE️YOU4 小时前
Python 数据结构的本质:位置、对象引用、Hash 与可变性
数据结构·python·哈希算法
李航19834 小时前
自动动手开发图形引擎,不仅能AI建模,还能AI渲染
人工智能·python·计算机视觉·ai·ai编程