- 博客(5)
- 资源 (1)
- 收藏
- 关注
原创 wustoj 1593: Count Zeros【线段树】
题目:http://acm.wust.edu.cn/problem.php?id=1593&soj=0解法:线段树维护因子2 5存在的个数。并判断是不是存在0代码:#include <stdio.h> #include <iostream> #include <string> #include <cstring> #include <cmath> #include <cstdlib> #includ
2016-04-25 17:17:35 447
原创 Leetcode 151. Reverse Words in a String
题目:https://leetcode.com/problems/reverse-words-in-a-string/代码:class Solution { public: void reverseWords(string &s) { string ans; ans.clear(); for (int i = 0;i != s.siz
2016-04-23 22:49:29 309
原创 循环有序数组查找值
循环数组,即有序的数组进行移位后的数组。 如:4,5,6,7,8,0,1,2,3查找值是否存在时,利用二分的思想。 步骤: while(L<R) 如果 a[mid] == key,return mid。 如果a[mid] > a[L],说明L-mid是有序的,mid+1 - R是循环的 如果key<a[mid] && key >= a[L],则key在L - mid-1之间,
2016-04-22 22:20:30 605
原创 hdu 3294 Girls' research【manacher】
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3294代码:#include <iostream> #include <cstdio> #include <string> #include <cstring> #include <fstream> #include <algorithm> #include <cmath> #include <queue
2016-04-19 16:07:35 342
原创 Codeforces Round #346 (Div. 2) ABCDE
题目:http://codeforces.com/contest/659/problems A:#include <iostream> #include <string>using namespace std;int n, a, b;int main() { while (cin >> n >> a >> b) { int ans; ans = (a
2016-04-03 17:10:56 371
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人