The trick is, we can work on a reversed vector - learnt from EPI.class Solution {public: vector plusOne(vector &digits) { std::reverse(digit...
分类:
其他好文 时间:
2014-07-22 00:33:36
阅读次数:
223
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...
分类:
其他好文 时间:
2014-07-21 10:00:12
阅读次数:
185
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...
分类:
其他好文 时间:
2014-07-21 09:14:10
阅读次数:
168
1877. Bicycle CodesTime limit: 0.5 secondMemory limit: 64 MBDen has two four-digit combination locks for protecting his bicycle from thieves. Every ev...
分类:
其他好文 时间:
2014-07-19 15:02:20
阅读次数:
313
Math.formatFloat = function (f, digit) { var m = Math.pow(10, digit); return parseInt(f * m, 10) / m; };使用:var fe...
分类:
编程语言 时间:
2014-07-17 00:12:05
阅读次数:
302
Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of digit ...
分类:
其他好文 时间:
2014-07-16 17:54:24
阅读次数:
222
class Solution {public: string countAndSay(int n) { vector num; num2digit(1, num); vector tmp; for (int i = 1; i &digit...
分类:
其他好文 时间:
2014-07-16 17:02:13
阅读次数:
144
Eddy's digital Roots
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4275 Accepted Submission(s): 2404
Problem Description
The digit...
分类:
其他好文 时间:
2014-07-14 20:30:11
阅读次数:
194
题目:已知S = Σ(i^i)其中(1
分析:数论,找规律。设 i = 10*a+b 则 i^i = (10*a+b)^(10*a+b),有:
记f(i)=(i^i)% 10 = (10*a+b)^(10*a+b)% 10 = b ^(10*a+b) { 二项式定理 }
利用f(i)找规律:
f(10*k+0)...
分类:
其他好文 时间:
2014-07-14 17:00:43
阅读次数:
557