
字符串
文章平均质量分 72
ChasingWaves
这个作者很懒,什么都没留下…
展开
-
POJ 3276(第二篇)开关问题
之前写了一篇,是用mod 2实现将int类型原创 2014-07-12 16:30:27 · 479 阅读 · 0 评论 -
hdu 4930 Fighting the Landlords 多校第六场 斗地主纯模拟
//0MS 312K#include#include#include#include#include#include#include#includeusing namespace std;char a[25];char b[25];int pp(char k){ if(k=='T') return 10; else if(k=='J')转载 2014-08-08 11:27:22 · 480 阅读 · 0 评论 -
POJ 1631 最长上升子序列O(nlogn)
/*POJ1631 AC */#include #include using namespace std;int BinSearch(int* a, int len, int num){ int left=0, right = len, mid; while(left <= right) { mid = left+(right-left)/2;原创 2014-03-14 13:44:23 · 542 阅读 · 0 评论 -
大整数减法模板
/*两个大整数减法模板,要求被减数大于减数*/#include #include #include using namespace std;char* BigIntMinus(char* s1, char* s2) //求s1-s2,其中s1>=s2{ int len1, len2, len, c, i; char* res; char tchar;原创 2014-01-01 14:29:23 · 527 阅读 · 0 评论 -
POJ 2533 Longest Ordered Subsequence
DescriptionA numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ..., aiK), where 1 <= i1 < i2 < .原创 2014-03-06 17:09:05 · 508 阅读 · 0 评论 -
UVa 10881 - Piotr's Ants
Piotr's AntsTime Limit: 2 secondsPiotr likes playing with ants. He has n of them on a horizontal pole L cm long. Each ant is facing either left or right and walks at a constant speed of 1 cm/s.转载 2014-02-04 17:35:27 · 488 阅读 · 0 评论 -
UVa 11991
map演示 #include #include #include using namespace std;map > a;int main(){ int n, m, x, y; while(scanf("%d%d", &n, &m) == 2) { a.clear(); for(int i=0; i<n; i++)转载 2014-02-12 12:02:39 · 504 阅读 · 0 评论 -
串的模式匹配KMP算法模板
/*串的模式匹配KMP算法模板,位置序号从1开始*/#include #include using namespace std;void GetNextVal(char T[], int nextval[]) //求模式串T的next函数修正值并存入数组nextval,数组下标从1开始{ int i=1, j=0, LenT=strlen(T)-1; nextval[1原创 2014-01-01 17:15:10 · 520 阅读 · 0 评论 -
CodeForces - Domino Effect
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Chris knows there's no fun in playing dominoes, he thinks it's too random原创 2014-03-24 22:50:18 · 541 阅读 · 0 评论 -
hdu 4911 Inversion 多校第五场 求逆序数
操作相邻的两个数,能够使逆序数对减1原创 2014-08-06 09:45:07 · 360 阅读 · 0 评论 -
hdu 4902 Nice boat(第二篇) 带push_up操作
//906MS 1972K#include #include #include #include #define lch(x) ((x)<<1)#define rch(x) ((x)<<1 | 1)using namespace std;const int maxn = 100000;int num[maxn+5];int tree[maxn<<2];bool flag[m原创 2014-08-01 14:27:09 · 368 阅读 · 0 评论 -
HDU3415单调队列
这题是单调队列的典型运用。至于单调队列,就是一个双端队列,在队首(f)出队,在队尾(b)出队入队,我们要维护整个队列的元素是单调的,比如,我们要动态查询从左向右的区间的最小值,那么我们就要在队列中维护一个单调递增的序列,从左向右枚举,队列的元素还有一个id值,代表这个元素在原序列中的位置,然后左边的元素如果不在范围内了,就判断队首的元素id是否是这个左边的id,是的话就出队,否则就转载 2014-04-12 23:36:04 · 424 阅读 · 0 评论 -
POJ 3276 Face The Right Way 开关问题
反转问题,WA了无数次了。。技巧是原创 2014-07-12 12:37:34 · 460 阅读 · 0 评论 -
POJ 2739 Sum of Consecutive Prime Numbers 素数打表+尺取法
http://poj.org/problem?id=2739普通的查原创 2014-07-11 11:17:31 · 414 阅读 · 0 评论 -
POJ 2566 Bound Found
http://poj.org/problem?id=2566这题参考了大健健原创 2014-07-10 17:44:00 · 462 阅读 · 0 评论 -
CF #250 The Child and Homework
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOnce upon a time a child got a test consisting of multiple-choice questions as ho原创 2014-06-01 23:28:14 · 632 阅读 · 0 评论 -
CF #248 A. Kitahara Haruki's Gift
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputKitahara Haruki has bought n apples for Touma Kazusa and Ogiso Setsuna. Now he wa原创 2014-05-24 20:22:31 · 508 阅读 · 0 评论 -
POJ 2100 Graveyard Design
Time Limit: 10000MS Memory Limit: 64000KTotal Submissions: 4589 Accepted: 980Case Time Limit: 2000MS原创 2014-07-11 16:54:54 · 442 阅读 · 0 评论 -
Next Date 求下一天的日期
没事做,写着玩玩#include #include using namespace std;struct Date{ int y, m, d;};int pm[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};bool isRunnian(int y){ if(y % 4 != 0) return原创 2014-06-26 16:18:27 · 2239 阅读 · 0 评论 -
CF B. Kolya and Tandem Repeat
Kolya got string s for his birthday, the string consists of small English letters. He immediately added k more characters to the right of the string.Then Borya came and said that the new string co原创 2014-06-20 22:12:39 · 906 阅读 · 0 评论 -
hdu 1002 大整数加法模板
/*求两个正整数的加法,Accepted*/#include #include #include using namespace std;char* BigIntAdd(char* s1, char* s2){ int len1, len2, len, c, i; char* res; char tchar; len1 = strlen(s1);原创 2014-01-01 14:21:52 · 493 阅读 · 0 评论