上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页
摘要: 以0结尾的数只与因子5*2有关,所以只要计算1-n之间2和5的个数,由于2的个数比5多的多(证明不会。。。),所以就只要计算5的个数就行了,编程之美上有这题~int trailingZeroes(int n) { int ret = 0 ; while(n){ ret+= ... 阅读全文
posted @ 2015-03-05 19:13 SprayT 阅读(105) 评论(0) 推荐(0)
摘要: char *convertToTitle(int n) { char num[20];int k = 0; while(n){ num[k++] = (n-1)%26 + 'A'; n = (n-1)/26; } for(int i = 0;i <... 阅读全文
posted @ 2015-03-04 21:14 SprayT 阅读(99) 评论(0) 推荐(0)
摘要: 方法一:排序取中间的那个数就行O(n*log(n));int cmp ( const void *a , const void *b){ return *(int *)a - *(int *)b;}int majorityElement(int num[], int n) { q... 阅读全文
posted @ 2015-03-04 19:31 SprayT 阅读(101) 评论(0) 推荐(0)
摘要: 水题,不过用c的话要自己写pow函数int pow(int x,int y){ int sum = 1; for(int i = 1 ; i <=y ; i++) sum*=x; return sum;}int titleToNumber(char s[]) { int le... 阅读全文
posted @ 2015-03-03 22:28 SprayT 阅读(114) 评论(0) 推荐(0)
摘要: 方法一:直接开个100010的数组水过。方法二:编程之美上O(1)的额外空间开销void reserve(int nums[],int n,int k){ int temp; for(int i = k ; i < (n+k)/2 ; i++) { temp = nums[... 阅读全文
posted @ 2015-03-03 20:57 SprayT 阅读(81) 评论(0) 推荐(0)
摘要: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace... 阅读全文
posted @ 2014-08-15 23:39 SprayT 阅读(252) 评论(0) 推荐(0)
摘要: 暴力找循环节,矩阵快速幂#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include usi... 阅读全文
posted @ 2014-08-15 10:45 SprayT 阅读(142) 评论(0) 推荐(0)
摘要: 树形dp#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using names... 阅读全文
posted @ 2014-08-14 17:02 SprayT 阅读(125) 评论(0) 推荐(0)
摘要: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace... 阅读全文
posted @ 2014-08-14 17:00 SprayT 阅读(103) 评论(0) 推荐(0)
摘要: #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace... 阅读全文
posted @ 2014-08-14 16:59 SprayT 阅读(89) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页