会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
SprayT
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
3
4
5
6
7
8
9
10
11
···
17
下一页
2015年3月5日
Factorial Trailing Zeroes
摘要: 以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)
2015年3月4日
Excel Sheet Column Title
摘要: 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)
Majority Element
摘要: 方法一:排序取中间的那个数就行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)
2015年3月3日
Excel Sheet Column Number
摘要: 水题,不过用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)
Rotate Array
摘要: 方法一:直接开个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)
2014年8月15日
最优对称路径
摘要: #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)
hdu 4291
摘要: 暴力找循环节,矩阵快速幂#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)
2014年8月14日
hdu 1520
摘要: 树形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)
poj 3468
摘要: #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)
hdu 1698
摘要: #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
下一页
公告