1 class Solution: 2 def calSum(self,x): 3 s = str(x) 4 sums = 0 5 for j in range(len(s)): 6 sums += int(s[j]) 7 return sums 8 9 d
转载 2020-04-05 04:55:00
63阅读
2评论
Starship Hakodate-maru Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 751 Accepted Submission(s)
原创 2021-07-21 15:49:16
129阅读
CF1399A Remove Smallest 洛谷传送门 题目描述 You are given the array aa consisting of nn positive (greater than zero) integers. In one move, you can choose two
转载 2020-11-02 11:19:00
392阅读
2评论
Given an integer n. Each number from 1 to n is grouped according to the sum of its digits. Return how many groups have the largest size. Example 1: In
转载 2020-04-17 10:32:00
92阅读
2评论
DescriptionGiven an integer n. Each number from 1 to n is grouped according to the sum of its digits.Return how many groups have the largest size.Exam
git
原创 2022-08-11 17:48:53
36阅读
Sum It Up时间限制: 1000ms 内存限制: 65535KB通过次数: 1总提交次数: 1问题描述Given a specified total t and a list of n integers, find all distinct sums using...
转载 2017-06-26 07:53:00
70阅读
2评论
题目1399:名侦探柯南 题目描述:     柯南又遇到了一个棘手的案子:一个贵族的家里被盗。这个贵族的家里非常有钱,但这家主人的习惯很怪异,他将所有的金银珠宝都磨成粉装到几个分开的袋子里。由于之前并没有记录,所以主人并不知道这次被盗自己损失了多少钱。几天后,盗窃犯被抓住,但是他身上仅有一个盗窃时用的包,盗窃走的财产早已经挥霍一空。很显然,盗窃犯一定会使自己偷走的东西的总价值最大,
给你一个整数 n 。请你先求出从 1 到 n 的每个整数 10 进制表示下的数位和(每一位上的数字相加),然后把数位和相等的数字放到同一个组中。 请你统计每个组中的数字数目,并返回数字数目并列最多的组有多少个。 示例 1: 输入:n = 13输出:4解释:总共有 9 个组,将 1 到 13 按数位求
转载 2020-09-28 22:22:00
22阅读
2评论
int countLargestGroup(int n){ int hash[37]={0}; int map[10001]={0}; int i, sum, tmp, max=0, cnt=0; for(i=1; i<=n; i++){ map[i]=map[i/10]+i%10; hash[ma
转载 2020-11-26 12:41:00
74阅读
2评论
给你一个整数 n 。请你先求出从 1 到 n 的每个整数 10 进制表示下的数位和(每一位上的数字相
原创 2022-06-13 13:42:36
93阅读
题目:原题链接(简单)解法时间复杂度空间复杂度执行用时Ans 1 (Python)O(NlogN)O(NlogN)O(NlogN)O(logN)O(logN)O(logN)88ms (85.88%)Ans 2 (Python)Ans 3 (Python)LeetCode的Python执行用时随缘,只要时间复杂度没有明显差异,执行用时一般都在同一个量级,仅作参考意义。解法一(暴力解法):def countLargestGroup(self,
原创 2021-08-26 10:34:44
28阅读
题目:原题链接(简单)解法时间复杂度空间复杂度执行用时Ans 1 (Python)O(NlogN)O(NlogN)O(NlogN)O(logN)O(logN)O(logN)88ms (85.88%)Ans 2 (Python)Ans 3 (Python)LeetCode的Python执行用时随缘,
原创 2022-02-18 14:27:55
135阅读
​​1399. 统计最大组的数目​​ 给你一个整数 ​​n​​​ 。请你先求出从 ​​1​​​ 到 ​​n​​ 的每个整数 10 进制表示下的数位和(每一位上的数字相加),然后把数位和相等的数字放到同一个组中。请你统计每个组中的数字数目,并返回数字数目并列最多的组有多少个。示例 1:输入:n = 13输出:4解释:总共有 9 个组,将 1 到 13 按数位求和后这些组分别是:[1,10],[2,1
原创 2023-01-31 15:08:15
49阅读
传送门 基环树的题当然先考虑树上怎么搞,直接求个直径就完事了 现在多了个环,先把非环上的直径(设为 $ans$)和环上节点 $x$ 到叶子的最大距离(设为 $dis[x]$)求出来 考虑到对于某种最优的方案,环上一定有某条边完全不用走 所以可以枚举断哪个边然后暴力,显然会 $T$ 飞 考虑能够快速求
转载 2019-09-17 10:57:00
51阅读
2评论
problem 1399. Count Largest Group 最开始没明白题意,每个英
原创 2022-07-11 09:57:21
28阅读
1399. 统计最大组的数目(C++)1 题目描述2 示例描述2.1 示例12.2 示例22.3 示例32.4 示
原创 2022-10-17 20:43:00
73阅读
0516-1399 /usr/sbin/mkvg: Physical volume contain some 3rd party volume group0516-1397 /usr/sbin/mkvg:The physical voume hdisk13, will not be added to the volume group.说明需要初始化PV# chdev -l hdisk13 -a p
原创 2018-06-01 16:55:44
1625阅读
作者: 负雪明烛id: fuxuemingzhu个人博客:http://fuxuemingzhu.cn/目录题目描述题目大意解题方法直接求日期题目地址:https://leetcode-cn.com/problems/count-largest-group/题目描述Given an integer n. Each number from 1 to n is gro...
原创 2022-02-09 10:11:36
98阅读
作者: 负雪明烛id: fuxuemingzhu个人博客:http://fuxuemingzhu.cn/目录题目描述题目大意解题方法直接求日期题目地址:https://leetcode-cn.com/problems/count-largest-group/题目描述Given an integer n. Each number from 1 to n is gro...
原创 2021-07-14 10:43:14
313阅读
  • 1
  • 2
  • 3
  • 4
  • 5