上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 19 下一页

2016年3月30日

刷题:蘑菇街最小移动次数

摘要: 题目描述 现在有一张半径为r的圆桌,其中心位于(x,y),现在他想把圆桌的中心移到(x1,y1)。每次移动一步,都必须在圆桌边缘固定一个点然后将圆桌绕这个点旋转。问最少需要移动几步。 输入描述: 一行五个整数r,x,y,x1,y1(1≤r≤100000,-100000≤x,y,x1,y1≤10000 阅读全文

posted @ 2016-03-30 20:16 RenewDo 阅读(131) 评论(0) 推荐(0) 编辑

刷题:蘑菇街回文串

摘要: 题目描述 给定一个字符串,问是否能通过添加一个字母将其变为回文串。 输入描述: 一行一个由小写字母构成的字符串,字符串长度小于等于10。 输出描述: 输出答案(YES\NO). 输入例子: coco 输出例子: YES #include<iostream> #include<string> usin 阅读全文

posted @ 2016-03-30 20:15 RenewDo 阅读(119) 评论(0) 推荐(0) 编辑

刷题:蘑菇街

摘要: 题目描述 给定一个字符串,问是否能通过添加一个字母将其变为回文串。 输入描述: 一行一个由小写字母构成的字符串,字符串长度小于等于10。 输出描述: 输出答案(YES\NO). 输入例子: coco 输出例子: YES #include<iostream> #include<string> usin 阅读全文

posted @ 2016-03-30 19:21 RenewDo 阅读(242) 评论(0) 推荐(0) 编辑

2016年3月29日

Range Sum Query - Mutable

摘要: 用到线段树,不懂,先标记着吧! [LeetCode]Range Sum Query - Mutable - 最美的时光 - 博客频道 - CSDN.NEThttp://blog.csdn.net/xyt8023y/article/details/49946789 x&(-x) Lowbit(x) - 阅读全文

posted @ 2016-03-29 17:35 RenewDo 阅读(166) 评论(0) 推荐(0) 编辑

Submission Details

摘要: class Solution { public: void deal(int i,int j,vector>&board,int h,int w) { typedef pair point; queueq; q.push(point(i,j)); board[i][j]='1'; while(... 阅读全文

posted @ 2016-03-29 16:33 RenewDo 阅读(179) 评论(0) 推荐(0) 编辑

Reverse Words in a String

摘要: class Solution { public: void reverseWords(string &s) { if(s.size()==0) return ; int i=0,j=s.size()-1; vector res; while((i::iterator it=++res.begin();it!=res.en... 阅读全文

posted @ 2016-03-29 15:30 RenewDo 阅读(118) 评论(0) 推荐(0) 编辑

Counting Bits

摘要: vector countBits(int num) { vector res; res.push_back(0); if(num==0)return res; res.push_back(1); for(int i=2;i<=num;i++) { int a=res[i... 阅读全文

posted @ 2016-03-29 14:50 RenewDo 阅读(105) 评论(0) 推荐(0) 编辑

Fraction to Recurring Decimal

摘要: 思路:1、对分子为0的可以提前返回 2、结果为正负的判断 3、数组越界(最小负数除以-1) 4、对于遇到小数的开始要加上“.”,有小数后可以扩大被除数,对于是否有重复的地方要判断其被除数是否重复了!!! 对于abs()函数切记,先把数转换为长整型,然后再用abs(),否则最小负数是转换不了正数的!! 阅读全文

posted @ 2016-03-29 12:04 RenewDo 阅读(155) 评论(0) 推荐(0) 编辑

字符串库函数总结

摘要: 1、strcat 2、strcmp 3、strcpy 4、strstr 阅读全文

posted @ 2016-03-29 10:00 RenewDo 阅读(179) 评论(0) 推荐(0) 编辑

2016年3月23日

各种排序算法总结

摘要: 1、冒泡排序 发现我这么多年还是容易把冒泡排序弄混,注意冒泡是第二层倒着来,两两比较!常规排序两层都顺着来会导致第一次比较小的反而转到后面: http://blog.csdn.net/cbs612537/article/details/8294960 2、直接插入排序 3、希尔排序 4、直接选择排序 阅读全文

posted @ 2016-03-23 22:08 RenewDo 阅读(258) 评论(0) 推荐(0) 编辑

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 19 下一页

导航