Re: [閒聊] 每日leetcode

看板Marginalman作者 (通通打死)時間3天前 (2026/01/04 22:58), 編輯推噓3(301)
留言4則, 4人參與, 3天前最新討論串1559/1561 (看更多)
寫了一大堆想要提早break 挺白吃的 一二三四五 def sumFourDivisors(self, nums: List[int]) -> int: rets = 0 for num in nums: st = set() st2 = -1 for div in range(2, int(math.sqrt(num)+1)): if num%div == 0: if div==st2: break elif len(st) != 0: st.add(div) break elif div==num//div: st = set() break else: st.add(div) st2 = num//div if len(st)==1: rets += st2 rets += (num//st2) rets += 1 rets += num return rets -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.132.58.28 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1767538728.A.064.html

01/04 23:00, 3天前 , 1F
這才發現這標題怎麼剩沒幾個在卷
01/04 23:00, 1F

01/04 23:04, 3天前 , 2F
別倦了
01/04 23:04, 2F

01/04 23:04, 3天前 , 3F
上岸就不卷了
01/04 23:04, 3F

01/04 23:05, 3天前 , 4F
我死在岸邊了
01/04 23:05, 4F
文章代碼(AID): #1fMe0e1a (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1fMe0e1a (Marginalman)