题目描述: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. 样例 Given num = 38. The process is like: 3 + ...
分类:
其他好文 时间:
2017-02-11 17:01:17
阅读次数:
187
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telepho ...
分类:
其他好文 时间:
2017-02-11 15:51:24
阅读次数:
176
【问题描述】 给定两个正整数a和b,求在[a,b]中的所有整数中,每个数码(digit)各出现了多少次。 【输入格式】 输入文件中仅包含一行两个整数a、b,含义如上所述。 【输出格式】 输出文件中包含一行10个整数,分别表示0-9在[a,b]中出现了多少次。 【输入样例】 1 99 【输出样例】 9 ...
分类:
其他好文 时间:
2017-02-04 21:19:44
阅读次数:
217
题目:POJ 3187 思路: 这道题很简单,用next_permutation枚举1~N的所有排列,然后依次相加,判断最后的和是否等于sum,是的话则break,即为字典序最前的。 注意: next_permutaiton()的两个参数分别是枚举起始的元素,和结束的元素的后一个元素。 ...
分类:
其他好文 时间:
2017-02-03 12:34:40
阅读次数:
213
You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai ...
分类:
其他好文 时间:
2017-01-31 10:29:09
阅读次数:
226
方法:数论 注意last digit只与m的最后一位和m有关,同时,如果了解number theory 中的multiplicative order 的话,就会发现,1-9 mod 10 的order 不是1 就是4, 所以结果只与m的最后一位和n mod 4的结果有关。而n mod 4 的结果只与 ...
分类:
其他好文 时间:
2017-01-30 10:42:59
阅读次数:
212
题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is l ...
分类:
其他好文 时间:
2017-01-25 15:26:48
阅读次数:
197
df -h ./ du -hs ./ du -h /ifs4/BC_RD/USER/lizhixin/my_project/human_chr22 | grep [[:digit:]+]G du [-abcDhHklmsSx] [-L ][-X ][--block-size][--exclude=]... ...
分类:
系统相关 时间:
2017-01-20 14:41:08
阅读次数:
220
http://poj.org/problem?id=3187 穷竭搜索 全排列 然后按规则求和 排列之前先按升序排序 这样可以保证第一个和为k的就是符合最小序列的结果 ...
分类:
其他好文 时间:
2017-01-19 02:01:41
阅读次数:
252
1833: [ZJOI2010]count 数字计数 Description 给定两个正整数a和b,求在[a,b]中的所有整数中,每个数码(digit)各出现了多少次。 Input 输入文件中仅包含一行两个整数a、b,含义如上所述。 Output 输出文件中包含一行10个整数,分别表示0-9在[a, ...
分类:
其他好文 时间:
2017-01-15 23:01:47
阅读次数:
251