当前位置:网站首页>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)
边栏推荐
- Small program wx.request simple Promise package
- 卷积神经网络(CNN)实现服装图像分类
- 各个架构指令集对应的机型
- 链读|最新最全的数字藏品发售日历-08.02
- Count down the six weapons of the domestic interface collaboration platform!
- The latest and most complete digital collection sales calendar-07.26
- 一个基于.Net Core 开源的物联网基础平台
- wiki confluence 安装
- 分享一款恋爱星座男女配对微信小程序源码
- 大端以及小端以及读寄存器习惯
猜你喜欢
随机推荐
卷积神经网络(CNN)实现mnist手写数字识别
Collection set interface
一个基于.Net Core跨平台小程序考试系统
先人一步,不再错过,链读APP即将上线!
[List Exercise] Traverse the collection and sort by price from low to high,
MySql constraints
图片批量添加水印批量缩放图片到指定大小
符号表
wiki confluence 安装
impdp import data
链读好文:Jeff Garzik 推出 Web3 制作公司
数据库 笔记 创建数据库、表 备份
集合 set接口
机器学习——聚类——商场客户聚类
我不喜欢我的代码
Multi-table query Notes
pytorch-08.加载数据集
索引笔记【】【】
程序员副业赚钱之道,实现月收入增加20K
pytorch-07.处理多维特征的输入