当前位置:网站首页>LeetCode 1894. Find the student number that needs to be supplemented with chalk
LeetCode 1894. Find the student number that needs to be supplemented with chalk
2022-08-10 05:55:00 【The study of surface letter ape】
python
class Solution:
def chalkReplacer(self, chalk: List[int], k: int) -> int:
sum_chalk = 0
for i in range(len(chalk)):
sum_chalk += chalk[i]
if(k>sum_chalk):
k = k%sum_chalk
i = 0
while(1):
k -= chalk[i%len(chalk)]
# print(k)
if(k<0):
break
i +=1
return i%len(chalk)
边栏推荐
- String common methods
- MySQL中MyISAM为什么比InnoDB查询快
- 复杂的“元宇宙”,为您解读,链读APP即将上线!
- pytorch-06.逻辑斯蒂回归
- Copy large files with crontab
- Mini Program Study Notes: Communication between Mini Program Components
- 卷积神经网络(CNN)实现服装图像分类
- 反射【笔记】
- 基于MNIST数据集的简单FC复现
- ORACLE system table space SYSTEM is full and cannot expand table space problem solving process
猜你喜欢
随机推荐
Chain Reading Recommendation: From Tiles to Generative NFTs
网络安全之防火墙
堆的原理与实现以及排序
PyTorch 之 可视化网络架构
pytorch-05.用pytorch实现线性回归
Bifrost micro synchronous database implementation services across the library data synchronization
error in ./node_modules/cesium/Source/ThirdParty/zip.js
智能合约和去中心化应用DAPP
I use this recruit let the team to improve the development efficiency of 100%!
Day1 微信小程序-小程序代码的构成
Mini Program Study Notes: Communication between Mini Program Components
学生管理系统以及其简单功能的实现
各个架构指令集对应的机型
[List Exercise] Traverse the collection and sort by price from low to high,
图片批量添加水印批量加背景缩放批量合并工具picUnionV4.0
String常用方法
Models corresponding to each architecture instruction set
Batch add watermark to pictures batch add background zoom batch merge tool picUnionV4.0
定时器(setInterval)的开启与关闭
我不喜欢我的代码