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

s[i] = int(a[i-1]) + s[i - 1]

枚举

区间

max_ = float('-inf')

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

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

tmp_ = s[i] - s[i - 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)

相关推荐
数据知道14 分钟前
claw-code 源码分析:大型移植的测试哲学——如何用 unittest 门禁守住「诚实未完成」的口碑?
开发语言·python·ai·claude code·claw code
炸炸鱼.22 分钟前
Python 网络编程入门(简易版)
网络·python
技术小黑23 分钟前
TensorFlow学习系列10 | 数据增强
python·深度学习·tensorflow2
万粉变现经纪人26 分钟前
如何解决 import aiohttp ModuleNotFoundError: No module named ‘aiohttp’
python·scrapy·beautifulsoup·aigc·pillow·pip·httpx
AC赳赳老秦30 分钟前
OpenClaw image-processing技能实操:批量抠图、图片尺寸调整,适配办公需求
开发语言·前端·人工智能·python·深度学习·机器学习·openclaw
liu****36 分钟前
第十五届蓝桥杯大赛软件赛国赛C/C++大学B组
c++·算法·蓝桥杯·acm
diving deep37 分钟前
从零构建大模型--实操--搭建python环境
开发语言·python
qq_白羊座1 小时前
Langchain、Cursor、python的关系
开发语言·python·langchain
小陈的进阶之路1 小时前
接口Mock测试
python·mock
kiku18181 小时前
Python网络编程
开发语言·网络·python