Given a 32-bit signed integer, reverse digits of an integer. 自己的代码: 这段代码逻辑没有问题,测试过一些位数的数字也没有问题,但是问题就处在那些超过int范围的数字,如代码中给出的那个数字,运行结果如下: 我们可以看到x已经不是原来的x ...
分类:
其他好文 时间:
2018-02-21 15:49:10
阅读次数:
96
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai ...
分类:
其他好文 时间:
2018-02-21 13:47:45
阅读次数:
188
http://acm.hdu.edu.cn/showproblem.php?pid=3022 题意: 最多不超过10000组数据,每组数据给定两个数n,m,求一个最小的数,使得该数每一位之和等于n,每一位的平方和等于m。 若无解或者答案超过100位,输出no solution。 n最大=900,m最 ...
分类:
其他好文 时间:
2018-02-19 15:59:45
阅读次数:
151
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai ...
分类:
其他好文 时间:
2018-02-19 13:48:33
阅读次数:
193
There is a box protected by a password. The password is n digits, where each letter can be one of the first k digits 0, 1, ..., k-1. You can keep inpu ...
分类:
其他好文 时间:
2018-02-18 00:05:02
阅读次数:
190
题意:给你字符串的长度和总和,让你构造出最大的数和最小的数,如果不行输出-1 思路:大佬们的思路还真是强啊,最大的数很容易做,最小的数是把最大的数进行反转,然后找到一个不为0的地方--,在前面++; 代码: ...
分类:
其他好文 时间:
2018-02-17 17:51:32
阅读次数:
152
Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 ...
分类:
其他好文 时间:
2018-02-13 13:28:43
阅读次数:
153
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai... ...
分类:
其他好文 时间:
2018-02-12 23:42:23
阅读次数:
334
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n.Example: Given n = 2, return 91. (The answer should be the ... ...
分类:
其他好文 时间:
2018-02-12 23:05:39
阅读次数:
266
题目就不再发了,大致意思就是给你一个十进制数n,算出阶乘后转换成K进制的数,你来算一下它的位数。 坑点在哪呢,就是这个数可能算阶乘的时候没放弄了,比如1000000,做过最多单算阶乘的题也就是让你算到10000,所以这个如果按正常步骤来写肯定不行啦。 本题主要运用两个定理: 1丶 十进制位数就是 ( ...
分类:
其他好文 时间:
2018-02-12 13:40:42
阅读次数:
142