问题描述:
Implement atoi to convert a string to an integer.
解题思路:
对于一个字符串需要注意一下几点:
1、过滤字符串开头的所有空格字符;
2、注意数字字符前面的“+”和“-”字符,从而确定数字的正负号;
3、只处理数字字符,一旦出现非数字字符,立即停止字符串处理,并返回已处理的结果;
4、返回结果时要注意数字越界的问题,不能...
分类:
其他好文 时间:
2014-07-31 00:03:45
阅读次数:
314
题目描述 Give you a lot of positive integers, just to find out how many prime numbers there are.. In each case, there is an integer N representing the num...
分类:
其他好文 时间:
2014-07-30 23:35:35
阅读次数:
300
SupermarketTime Limit: 2000msMemory Limit: 65536KBThis problem will be judged onPKU. Original ID:145664-bit integer IO format:%lld Java class name:Mai...
分类:
其他好文 时间:
2014-07-30 23:19:55
阅读次数:
318
Android的编辑框控件EditText在平常编程时会经常用到,有时候会对编辑框增加某些限制,如限制只能输入数字,最大输入的文字个数,不能输入 一些非法字符等,这些需求有些可以使用android控件属性直接写在布局xml文件里,比如android:numeric="integer"(只允 许输入....
分类:
移动开发 时间:
2014-07-30 20:26:54
阅读次数:
259
Ancient Cipher
Ancient Roman empire had a strong government system with various departments, including a secret service department. Important documents were sent between provinces and the capit...
分类:
其他好文 时间:
2014-07-30 17:35:14
阅读次数:
227
Watch The Movie
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/65535K (Java/Other)
Total Submission(s) : 10 Accepted Submission(s) : 4
Font: Times New Roman | Verdana | Georgia
Fon...
分类:
其他好文 时间:
2014-07-30 14:57:54
阅读次数:
264
Problem Description
Given a positive integer n, your task is to find a positive integer m, which is a multiple of n, and that m contains the least number of different digits when represented in decim...
分类:
其他好文 时间:
2014-07-30 14:46:03
阅读次数:
230
Time Limit: 5000MS
Memory Limit: 65536K
Total Submissions: 3516
Accepted: 1651
Description
Given a prime P, 2 31, an integer B, 2
BL == N (mod P)
Input
Read severa...
分类:
其他好文 时间:
2014-07-30 12:27:53
阅读次数:
331
C. Marlon's StringTime Limit: 2000msMemory Limit: 65536KB64-bit integer IO format:%lld Java class name:MainLong long ago, there was a coder named Marl...
分类:
其他好文 时间:
2014-07-30 12:08:23
阅读次数:
206
解法:考虑多种情况 1 #include 2 3 class Solution { 4 public: 5 int atoi(const char *str) { 6 int signal = 0; /*标记正负,还未出现判定正负的标志时,记为0*/ 7 ...
分类:
其他好文 时间:
2014-07-30 11:57:03
阅读次数:
182