iqhy's recent timeline updates
iqhy

iqhy

V2EX member #530946, joined on 2021-01-28 22:53:49 +08:00
iqhy's recent replies
Mar 16, 2021
Replied to a topic by megachweng 问与答 请问有没有色弱辅助 app
Color Blind Pal
Feb 19, 2021
Replied to a topic by 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   ·   839 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 21:50 · PVG 05:50 · LAX 14:50 · JFK 17:50
♥ Do have faith in what you're doing.