2023-07-12 2024-08-05 problem 几秒读完 (大约59个字) 0次访问lc2544. 交替数字和题目链接:2544. 交替数字和 - 力扣(Leetcode) 题解 按题意模拟 参考代码 123456789class Solution: def alternateDigitSum(self, n: int) -> int: s = 0 f = 1 for i in str(n): s += f * int(i) f = f*-1 return s lc2544. 交替数字和https://blog.xiang578.com/problem/lc2544.html作者Ryen Xiang发布于2023-07-12更新于2024-08-05许可协议 LeetCode