V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
V2EX  ›  iqhy  ›  全部回复第 1 页 / 共 1 页
回复总数  2
2021 年 3 月 16 日
回复了 megachweng 创建的主题 问与答 请问有没有色弱辅助 app
Color Blind Pal
2021 年 2 月 19 日
回复了 goodboy95 创建的主题 问与答 请教 Python 快速寻找连续 1 的问题
def main2():
....res = 0
....for row in mapData:
........isOne = False
........for j, element in enumerate(row):
............if not isOne and element == 1:
................isOne = True
................res += j
............elif isOne and element == 0:
................isOne = False
................res += (j - 1)
........if isOne:
............res += j

这样遍历快一点
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   930 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 22:47 · PVG 06:47 · LAX 15:47 · JFK 18:47
♥ Do have faith in what you're doing.