码迷,mamicode.com
首页 >  
搜索关键字:digits    ( 2164个结果
1005. Spell It Right (20)
注意字符串的输入方法char a[100] = { 0 };scanf("%s", &a);Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every...
分类:其他好文   时间:2015-12-03 21:04:19    阅读次数:213
258. Add Digits
题目:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3...
分类:其他好文   时间:2015-12-03 07:11:38    阅读次数:145
[lintcode easy]Reverse Integer
Reverse digits of an integer. Returns 0 when the reversed integer overflows (signed 32-bit integer).ExampleGiven x = 123, return 321Given x = -123, re...
分类:其他好文   时间:2015-12-01 07:09:05    阅读次数:131
[LeetCode]Add Digits
一个小规律public class Solution { public int addDigits(int num) { if (num < 9) { return num; } return num % 9 == 0 ? 9 :...
分类:其他好文   时间:2015-11-30 07:18:50    阅读次数:246
Add Digits
循环求解方式不再赘述。O(1)时间的方法:公式:(num-1)%9 + 1;假设num为一个五位数,num = (a + b + c + d + e) + (a * 9999 + b * 999 + c * 99 + d * 9),将num对9取余后,结果为a + b + c + d + e。反复执...
分类:其他好文   时间:2015-11-29 16:16:48    阅读次数:118
USACO 1.5 Superprime Rib
Superprime RibButchering Farmer John's cows always yields the best prime rib. You can tell prime ribs by looking at the digits lovingly stamped across...
分类:其他好文   时间:2015-11-28 15:07:18    阅读次数:151
Add Digits
Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ...
分类:其他好文   时间:2015-11-28 11:50:50    阅读次数:125
Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:其他好文   时间:2015-11-28 06:31:42    阅读次数:122
Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:其他好文   时间:2015-11-27 23:35:14    阅读次数:174
leetcode Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
分类:其他好文   时间:2015-11-26 14:43:22    阅读次数:120
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!