蓝桥杯刷题--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)

相关推荐
晓子文集17 分钟前
Tushare接口文档:指数成分和权重(index_weight)
大数据·数据库·python·金融·量化投资
小大宇25 分钟前
python pandas dataFrame sqlAlchemy案例
python·pandas
淼澄研学28 分钟前
Python进阶实战:深入解析推导式与生成器等5大核心特性
开发语言·python
xlrqx1 小时前
商丘家电清洗培训零基础学习需掌握哪些要点零基础到底能不能学
python·学习
卷无止境1 小时前
Python虚拟环境江湖:从venv到uv,如何避开依赖冲突的坑
后端·python
玉鸯1 小时前
Agent Harness 工程核心架构拆解与 300 行代码实现
python·agent
米码收割机1 小时前
【Python】Django 电子设备商城系统(源码+说明文档)[独一无二]
开发语言·python·django
互联网中的一颗神经元1 小时前
小白python入门 - 38. 动态内容:接口优先与自动化扫盲
开发语言·python·自动化
卷无止境2 小时前
模块与包:Python 代码组织的两层逻辑
后端·python
夏日清风有你2 小时前
OpenDataLab 数据集下载
python