当前位置:网站首页>LeetCode 1894.找到需要补充粉笔的学生编号
LeetCode 1894.找到需要补充粉笔的学生编号
2022-08-10 05:32:00 【生信研究猿】
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
- Smart contracts and DAPP decentralized applications
- 先人一步,不再错过,链读APP即将上线!
- 集合 Map
- [List Exercise] Traverse the collection and sort by price from low to high,
- The complex "metaverse" will be interpreted for you, and the Link Reading APP will be launched soon!
- cesium add point, move point
- 智能合约和去中心化应用DAPP
- opencv
- 第二次实验
猜你喜欢
Day1 微信小程序-小程序代码的构成
Set Sources Resources and other folders in the IDEA project
pytorch-09.多分类问题
Chain Reading | The latest and most complete digital collection calendar-07.28
MySql constraints
ORACLE系统表空间SYSTEM占满无法扩充表空间问题解决过程
细说MySql索引原理
Ten years of sharpening a sword!The digital collection market software, Link Reading APP is officially open for internal testing!
链读好文:Jeff Garzik 推出 Web3 制作公司
Chain Reading Good Article: Jeff Garzik Launches Web3 Production Company
随机推荐
去中心化和p2p网络以及中心化为核心的传统通信
pytorch-07.处理多维特征的输入
A little knowledge point every day
链读好文:Jeff Garzik 推出 Web3 制作公司
多表查询 笔记
常用类 String概述
Knowledge Distillation Thesis Learning
树结构——2-3树图解
利用 crontab 拷贝大文件
Collection set interface
Batch add watermark to pictures batch scale pictures to specified size
网络安全3
Models corresponding to each architecture instruction set
Consensus calculation and incentive mechanism
win12 修改dns脚本
微信小程序--模板与设置WXML
ZigBee 网络设备相关内容
Linux database Oracle client installation, used for shell scripts to connect to the database with sqlplus
generic notes()()()
Chain Reading | The latest and most complete digital collection calendar-07.28