• HDU 4333 Revolving Digits

    时间:2022-08-24 07:57:35

    扩展KMP的应用我们发现本题的关键在于如何高效的判断两个同构字符串的大小关系,想到如果能够预处理出每一个同构字符串与原字符串的最长公共前缀,那么直接比较它们不一样的部分就好,扩展KMP正好是用来处理这样的问题的,把原串copy一遍加在其后,在其上跑一遍exKMP的next数组,就预处理出了所有同构字...

  • HDU-1664-Different Digits(BFS)

    时间:2022-06-14 05:38:18

    ProblemDescriptionGivenapositiveintegern,yourtaskistofindapositiveintegerm,whichisamultipleofn,andthatmcontainstheleastnumberofdifferentdigitswhenrepr...

  • 2292: Quality of Check Digits 中南多校 暴力枚举

    时间:2022-05-31 20:57:23

    #include<cstdio>#include<algorithm>#include<cstring>#include<iostream>usingnamespacestd;typedeflonglongll;constintmaxn=4e4+100...

  • leetcode之旅(6)-Add Digits

    时间:2022-05-17 22:10:56

    题目:Givenanon-negativeintegernum,repeatedlyaddallitsdigitsuntiltheresulthasonlyonedigit.Forexample:Givennum=38,theprocessislike:3+8=11,1+1=2.Since2haso...

  • LeetCode Javascript实现 258. Add Digits 104. Maximum Depth of Binary Tree 226. Invert Binary Tree

    时间:2022-05-05 01:06:00

    258.AddDigitsDigitroot数根问题/***@param{number}num*@return{number}*/varaddDigits=function(num){varb=(num-1)%9+1;returnb;};//之所以num要-1再+1;是因为特殊情况下:当num是9的...

  • Win10 安装 digits

    时间:2022-04-23 01:32:36

    DownloadandinstallPython2.7.1164bitfromPython‘sofficialsite(https://www.python.org/ftp/python/2.7.11/python-2.7.11.amd64.msi).PleaseselectAddPythonPat...

  • How many zero's and how many digits ? UVA - 10061

    时间:2022-03-28 05:36:27

    Givenadecimalintegernumberyouwillhavetofindouthowmanytrailingzeroswillbethereinitsfactorialinagivennumbersystemandalsoyouwillhavetofindhowmanydigitswi...

  • Codeforces 915 C. Permute Digits (dfs)

    时间:2022-03-10 05:44:41

    题目链接:PermuteDigits题意:给出了两个数字a,b(<=1e18),保证a,b都不带前缀0。用a的字符重组一个数字使这个值最大且小于b。(保证这个值存在)题解:这题遇到了不止一遍了,但是每次都会写错~所以感觉很有必要写下来。看到这题,我的第一想法是贪心每次都取最大的。但是这样其实存...

  • LeetCode:Add Digits - 非负整数各位相加

    时间:2022-02-25 02:15:53

    1、题目名称AddDigits(非负整数各位相加)2、题目地址https://leetcode.com/problems/add-digits/3、题目内容英文:Givenanon-negativeintegernum,repeatedlyaddallitsdigitsuntiltheresulth...

  • 【LeetCode】258. Add Digits (2 solutions)

    时间:2022-01-16 01:33:26

    AddDigitsGivenanon-negativeinteger num,repeatedlyaddallitsdigitsuntiltheresulthasonlyonedigit.Forexample:Given num=38,theprocessislike: 3+8=11, 1+1=2....

  • LeetCode(258) Add Digits

    时间:2022-01-16 01:33:08

    题目Givenanon-negativeintegernum,repeatedlyaddallitsdigitsuntiltheresulthasonlyonedigit.Forexample:Givennum=38,theprocessislike:3+8=11,1+1=2.Since2hason...

  • [LeetCode&Python] Problem 258. Add Digits

    时间:2022-01-16 01:33:32

    Givenanon-negativeinteger num,repeatedlyaddallitsdigitsuntiltheresulthasonlyonedigit.Example:Input:38Output:2Explanation:Theprocessislike:3+8=11,1+1=2...

  • [LeetCode] Add Digits (a New question added)

    时间:2022-01-16 01:33:20

    Givenanon-negativeinteger num,repeatedlyaddallitsdigitsuntiltheresulthasonlyonedigit.Forexample:Given num=38,theprocessislike: 3+8=11, 1+1=2.Since 2 h...

  • LN : leetcode 258 Add Digits

    时间:2022-01-16 01:33:14

    lc258AddDigitslc258AddDigitsGivenanon-negativeintegernum,repeatedlyaddallitsdigitsuntiltheresulthasonlyonedigit.Forexample:Givennum=38,theprocessislik...

  • LeetCode 258. 各位相加(Add Digits)

    时间:2022-01-16 01:33:14

    258.各位相加258.AddDigits题目描述给定一个非负整数num,反复将各个位上的数字相加,直到结果为一位数。LeetCode258.AddDigits示例:输入:38输出:2解释:各位相加的过程为:3+8=11,1+1=2。由于2是一位数,所以返回2。进阶:你可以不使用循环或者递归,且在O...

  • uva 993 Product of digits (贪心 + 分解因子)

    时间:2021-12-31 09:16:44

      Productofdigits Foragivennon-negativeintegernumber N ,findtheminimalnatural Q suchthattheproductofalldigitsof Q isequal N .InputThefirstlineofinputc...

  • (贪心5.2.6)URAL 1014 Product of Digits(利用数据有序化进行贪心选择)

    时间:2021-09-14 15:26:21

    /**URAL_1014.cpp**Createdon:2013年10月11日*Author:Administrator*/#include<iostream>#include<cstdio>#include<cmath>#include<algorithm...

  • 【LeetCode】1085. Sum of Digits in the Minimum Number 解题报告(C++)

    时间:2021-09-07 06:39:49

    作者:负雪明烛id:fuxuemingzhu个人博客:http://fuxuemingzhu.cn/目录题目描述题目大意解题方法遍历日期题目地址:https://leetcode-cn.com/problems/sum-of-digits-in-the-minimum-number/题目描述Give...

  • LA 6856 Circle of digits 解题报告

    时间:2021-08-21 09:58:09

    题目链接先用后缀数组给串排好序。dc3O(n)二分答案+贪心check答案的长度len=(n+k-1)/k如果起点为i长为len串大于当前枚举的答案,i的长度取len-1从起点判断k个串的长度是否大于等于ncheck的时候最多枚举len个起点,每个位置需要枚举n/len个串,时间复杂度O(n),总的...

  • 【LeetCode】Add Digits

    时间:2021-08-18 02:18:28

    AddDigitsGivenanon-negativeinteger num,repeatedlyaddallitsdigitsuntiltheresulthasonlyonedigit.Forexample:Given num=38,theprocessislike: 3+8=11, 1+1=2....