- 博客(46)
- 收藏
- 关注
原创 【UESTC 1357 柱爷与最大区间和】+ 最大前缀和 + 最大后缀和
柱爷与最大区间和 Time Limit: 1000/1000MS (Java/Others) Memory Limit: 131071/65535KB (Java/Others) Submit Status 柱爷爱思考,凡事喜欢举一反三,常常能想到别人没想过的问题。比如最大区间和这个问题:在一数列上选出一段区间,使得这段区间和最大。柱爷想:如果选出两段区间(不相邻)会怎样呢?柱爷很快想到了答
2017-03-30 18:16:54 1110
原创 【UESTC 1386 卿大爷的三个女友】+ KMP
卿大爷发现了一个字符串,他要在上面找到3 3 个女朋友的名字。他的一个女朋友名字是字符串的前缀,一个是后缀,还有一个在中间的某个位置(三者不互相重叠)。他想让你告诉他他女朋友名字的最大长度是多少。也就是说找到一个最长的子串使得它既是前缀又是后缀,还在中间,求这个子串的长度。 Input 第一行一个数字N(N<=100) N(N<=100) ,代表有N组数据。 接下来N行,每
2017-03-29 21:04:48 416
原创 【ACdream 1077 LCM Challenge】+ 规律
Some days ago, I learned the concept of LCM (least common multiple). I’ve played with it for several times and I want to make a big number with it.But I also don’t want to use many numbers, so I’ll cho
2017-03-28 18:13:23 351
原创 【ACdream 1061- 郭式树】+ 大数运算
郭橐驼,不知始何名。病偻,隆然伏行,有类橐驼者,故乡人号之驼。驼闻之,曰:“甚善。名我固当。”因舍其名,亦自谓橐驼云。其乡曰丰乐乡,在长安西。驼业种树,凡长安豪富人为观游及卖果者,皆争迎取养。视驼所种树,或移徙,无不活;且硕茂,蚤实以蕃。他植者虽窥伺效慕,莫能如也。 有问之,对曰:“橐驼非能使木寿且孳也,以能顺木之天,以致其性焉尔。凡植木之性,其本欲舒,其培欲平,其土欲故,其筑欲密。既然已,勿动
2017-03-28 18:11:27 361
原创 【UESTC 1329 卿学姐与魔法】+ 优先队列
卿学姐与魔法 Time Limit: 1200/800MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit Status “你的膜法也救不了你”——蛤在去拯救公主的道路上,卿学姐披荆斩棘,刀刃早已锈迹斑斑。一日卿学姐正在为武器的问题发愁,碰到了正在赏树的天行廖。天行廖嘴角微扬,似乎看穿了卿学姐的心思,故意在此等待。
2017-03-27 20:07:59 492
原创 【UESTC 1523 我想上厕所】
我想上厕所 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit Status 正如地球上有三种性别的人(男、女、秀吉),需要三种厕所。EX星也是,这里有n个性别,每个性别对应一个厕所,性别i对应厕所i。现在所有的n种厕所按1、2、3……n的顺序围成一个圈(每种一个),每个
2017-03-26 20:22:49 486
原创 【UESTC 1510 渐变字符串】 + 贪心
渐变字符串 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit Status 如果一个字符串,它每个字母(第一个除外)为前一个字母的后一位,则这样的字符串被称为“渐变字符串”。如:”abcde”, “hijklmnopqr”等等你有n个写有小写字母的卡片,你要将它们组成尽
2017-03-26 20:10:51 628
原创 【UESTC 1513 简单的数学题】
简单的数学题 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit Status 这是一道简单的数学题,简单到题目只给你一个正整数N,而你则输出一个M,这个M是由N的各个位数重新排列而来的(比如,N=123,则M可以为123,213,321,312,132,231)。由于M
2017-03-26 20:06:47 1153
原创 【UESTC 1334 郭大侠与Rabi-Ribi】+ 贪心 + 优先队列
郭大侠与Rabi-Ribi Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit Status title最近郭大侠迷上了玩Rabi-Ribi这个游戏。Rabi-Ribi呢,是一个打兔子的动作冒险游戏,萌萌哒的兔子在地上跑来跑去,好萌好萌呀~这个游戏是这样玩的,郭大侠作为一
2017-03-26 19:52:21 672
原创 【POJ 2192 Zipper】+ 贪心 + 字符匹配
Zipper Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 18323 Accepted: 6523 DescriptionGiven three strings, you are to determine whether the third string can be formed by comb
2017-03-26 11:47:37 472
原创 【POJ 3050 Hopscotch】+ DFS + set
Hopscotch Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4088 Accepted: 2723 DescriptionThe cows play the child’s game of hopscotch in a non-traditional way. Instead of a linear
2017-03-26 11:01:41 469
原创 【HDU 1027 Ignatius and the Princess II】+ 排列组合
Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7897 Accepted Submission(s): 4664Problem Description Now our
2017-03-25 20:54:51 417
原创 【POJ 2255 Tree Recovery】+ 二叉树
Tree Recovery Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14637 Accepted: 9088 DescriptionLittle Valentine liked playing with binary trees very much. Her favorite game was
2017-03-24 21:41:47 389
原创 【PTA 5-11 玩转二叉树 (25分)】+ 二叉树
5-11 玩转二叉树 (25分) 给定一棵二叉树的中序遍历和前序遍历,请你先将树做个镜面反转,再输出反转后的层序遍历的序列。所谓镜面反转,是指将所有非叶结点的左右孩子对换。这里假设键值都是互不相等的正整数。 输入格式:输入第一行给出一个正整数N(\le≤30),是二叉树中结点的个数。第二行给出其中序遍历序列。第三行给出其前序遍历序列。数字间以空格分隔。 输出格式:在一行中输出该树反转后的层
2017-03-23 21:48:46 1566
原创 【PTA 5-10 树的遍历 (25分)】+ 二叉树
5-10 树的遍历 (25分) 给定一棵二叉树的后序遍历和中序遍历,请你输出其层序遍历的序列。这里假设键值都是互不相等的正整数。 输入格式:输入第一行给出一个正整数NN(\le 30≤30),是二叉树中结点的个数。第二行给出其后序遍历序列。第三行给出其中序遍历序列。数字间以空格分隔。 输出格式:在一行中输出该树的层序遍历的序列。数字间以1个空格分隔,行首尾不得有多余空格。 输入样例:7
2017-03-23 21:26:57 3153
原创 【PTA 5-1 N个数求和 (20分)】+ gcd
5-1 N个数求和 (20分) 本题的要求很简单,就是求N个数字的和。麻烦的是,这些数字是以有理数分子/分母的形式给出的,你输出的和也必须是有理数的形式。输入格式:输入第一行给出一个正整数N(\le≤100)。随后一行按格式a1/b1 a2/b2 …给出N个有理数。题目保证所有分子和分母都在长整型范围内。另外,负数的符号一定出现在分子前面。输出格式:输出上述数字和的最简形式 —— 即将结果写成
2017-03-23 18:28:30 1868
原创 【HDU 1716 排列2】+ DFS
排列2 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7950 Accepted Submission(s): 2952Problem Description Ray又对数字的列产生了兴趣: 现有四张卡片,用这四张卡片能排列
2017-03-21 22:10:19 372
原创 【Codeforces Gym 100187F 】+ 贪心
Doomsday comes in t units of time. In anticipation of such a significant event n people prepared m vaults in which, as they think, it will be possible to survive. But each vault can accommodate only k
2017-03-20 21:49:29 543
原创 【Codeforces Gym 100187A】
A - A Gym - 100187A The world famous scientist Innokentiy has just synthesized the potion of immortality. Unfortunately, he put the flask with this potion on the shelf where most dangerous poisons of
2017-03-20 20:22:24 657
原创 【HDU 1426 Sudoku Killer】+ DFS
Sudoku KillerTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7657 Accepted Submission(s): 2364Problem Description 自从2006年3月10日至11日的首届数独世界锦标
2017-03-16 22:35:51 713
原创 【HDU 1398 Square Coins】+ 母函数
Square CoinsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11874 Accepted Submission(s): 8142Problem Description People in Silverland use
2017-03-16 21:36:05 603
原创 【POJ 2549 Sumsets】+ 技巧枚举
Sumsets Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11084 Accepted: 3032 DescriptionGiven S, a set of integers, find the largest d such that a + b + c = d where a, b, c, a
2017-03-16 20:40:44 654
原创 【Codeforces 140 A. New Year Table】 + 精度
A. New Year Table time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Gerald is setting the New Year table. The table has the form of a circle
2017-03-16 20:09:36 409
原创 【POJ 1716 Integer Intervals】+ 差分约束
Integer Intervals Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 14475 Accepted: 6149 DescriptionAn integer interval [a,b], a < b, is a set of all consecutive integers beginn
2017-03-16 18:21:41 576
原创 【POJ 2718 Smallest Difference】+ 排列组合
Smallest Difference Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10493 Accepted: 2867 DescriptionGiven a number of distinct decimal digits, you can form one integer by choo
2017-03-16 15:39:51 641
原创 【HDU 5969 最大的位或】 + 异或
最大的位或Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1137 Accepted Submission(s): 462Problem Description B君和G君聊天的时候想到了如下的问题。 给定自然数l和r ,选取2
2017-03-13 20:39:19 576
原创 【数据结构 链表】
当调用一个新的指针时~必须要 new 不然会产生意想不到的错误 -~-AC代码:#include<iostream>using namespace std;typedef struct node{ int data; struct node *next;}*n;int InitList_L(n &L){ L = new node; L -> next =
2017-03-12 17:44:43 333
原创 【数据结构 顺序表】
AC代码:#include<iostream>using namespace std;typedef struct{ int *e,length;}node;int InitList_Sq(node &L){ L.e = new int[100]; if(!L.e) return 0; L.length = 0; return 1;}int Loc
2017-03-12 17:40:35 323
原创 【Codeforces 780 D Innokenty and a Football League 】+ 模拟 + 贪心
D. Innokenty and a Football League time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Innokenty is a president of a new football league in By
2017-03-12 12:27:13 744
原创 【HDU 2824 The Euler function】+ 欧拉函数
The Euler functionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6488 Accepted Submission(s): 2736Problem Description The Euler function p
2017-03-11 21:08:00 417
原创 【HDU 5635 LCP Array】
LCP ArrayTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1554 Accepted Submission(s): 476Problem Description Peter has a string s=s1s2…sn
2017-03-11 18:06:12 346
原创 【HDU 1027 Ignatius and the Princess II】+ 全排列 + STL
Ignatius and the Princess IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7832 Accepted Submission(s): 4626Problem Description Now our he
2017-03-11 11:14:40 375
原创 【HDU 1466 计算直线的交点数】+ dp
计算直线的交点数Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9762 Accepted Submission(s): 4449Problem Description 平面上有n条直线,且无三线共点,问这些直线能有多少种不同交点
2017-03-11 11:00:10 395
原创 【HDU 5666 Segment】+ 俄罗斯乘法
SegmentTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1771 Accepted Submission(s): 655Problem Description Silen August does not like t
2017-03-10 22:14:56 478
原创 【POJ 3187 Backward Digit Sums】 + DFS + 排列组合
Backward Digit Sums Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7041 Accepted: 4083 DescriptionFJ and his cows enjoy playing a mental game. They write down the numbers from 1 to N (
2017-03-10 21:18:06 343
原创 【POJ 2186 Popular Cows】+ 强连通
Popular Cows Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 32649 Accepted: 13307 DescriptionEvery cow’s dream is to become the most popular cow in the herd. In a herd of N (1 <= N <=
2017-03-09 20:03:25 328
原创 【POJ 2104 K-th Number】
K-th Number Time Limit: 20000MS Memory Limit: 65536K Total Submissions: 53671 Accepted: 18479 Case Time Limit: 2000MS DescriptionYou are working for Macrohard company in data structures departme
2017-03-08 21:51:19 219
原创 【HDU 5344 MZL's xor】+ 异或
MZL’s xorTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1259 Accepted Submission(s): 780Problem Description MZL loves xor very much.Now he
2017-03-08 21:18:45 399
原创 【HDU 5311 Hidden String】+ 字符串
Hidden StringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1945 Accepted Submission(s): 721Problem Description Today is the 1st anniver
2017-03-08 20:56:24 319
原创 【HDU 5444 Elven Postman】+ 二叉树
Elven PostmanTime Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1828 Accepted Submission(s): 1044Problem Description Elves are very peculiar
2017-03-07 21:33:09 560
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人