
ACM
FZH_SYU
在这个时代,每个人怀揣着梦想,坚持地迈着步子走。这个时代,正因如此,才会愈发精彩。
展开
-
codeforce-762-B USB vs. PS/2(贪心)
Due to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given the task of buying mouses, and you have to spend as little as possi原创 2017-01-26 00:56:34 · 836 阅读 · 0 评论 -
codeforces-762A k-th divisor(数学题)
You are given two integers n and k. Find k-th smallest divisor of n, or report that it doesn’t exist.Divisor of n is any such natural number, that n can be divided by it without remainder. InputThe fi原创 2017-01-26 00:50:18 · 1333 阅读 · 0 评论 -
codeforces-757-B Bash's Big Day(简单题)
Bash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he went to Professor Zulu’s Lab. Since Bash is Professor Zulu’s favourite student, Zulu allows him to take原创 2017-01-25 18:00:13 · 869 阅读 · 0 评论 -
codeforces-758-B Blown Garland(简单数学)
Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland.Now he has a goal to replace dead light bulbs, however he doesn’t know how man原创 2017-01-25 17:52:33 · 622 阅读 · 0 评论 -
hdu 1671 Phone List(排序)
Problem Description Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers: 1. Emergency原创 2017-01-25 17:02:51 · 411 阅读 · 0 评论 -
codeforces-755D-PolandBall and Polygon(数学题)
PolandBall has such a convex polygon with n veritces that no three of its diagonals intersect at the same point. PolandBall decided to improve it and draw some red segments.He chose a number k such tha原创 2017-01-17 03:22:26 · 1084 阅读 · 0 评论 -
codeforces-755-B PolandBall and Game
PolandBall is playing a game with EnemyBall. The rules are simple. Players have to say words in turns. You cannot say a word which was already said. PolandBall starts. The Ball which can’t say a new wo原创 2017-01-17 03:00:17 · 1097 阅读 · 0 评论 -
Codeforces-743B-Chloe and the sequence(二进制思维题)
Chloe and the sequenceChloe, the same as Vladik, is a competitive programmer. She didn’t have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the olympiad.原创 2017-01-14 20:58:04 · 634 阅读 · 0 评论 -
Codeforces-754B-Ilya and tic-tac-toe game(简单模拟判断)
Ilya and tic-tac-toe gameIlya is an experienced player in tic-tac-toe on the 4 × 4 field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The friends became t原创 2017-01-14 20:54:30 · 1002 阅读 · 0 评论 -
codeforces-754A-Lesha and array splitting(简单分类处理)
Lesha and array splittingOne spring day on his way to university Lesha found an array A. Lesha likes to split arrays into several parts. This time Lesha decided to split the array A into several, possi原创 2017-01-14 20:52:46 · 866 阅读 · 0 评论 -
大二上学期小结
日子过的真的是快,转眼间又快到了放假的时候。这一学期,作为大二,好好体验了一把学长的滋味(不过也是挺难当的,毕竟怎么说也得做好这个榜样),看着以前写过的博客,号称自己皂兄,这一学期过去,我就得给自己改一个外号了——晖姐!哈哈哈,不要怀疑,我是汉子,真汉子!这一学期,我对自己的生活轨迹做了一些调整,离开了团总支的文艺部,找了班上玩的来的朋友顶替了党支部的工作,棋奕社团,书法协会,我都没有多大去在意过了原创 2016-12-26 13:22:54 · 1012 阅读 · 0 评论 -
2015 上海(题解)
A(概率dp+贪心) 建立状态dp[i], 表示敲出i个字符的期望次数, 那么有 dp[i] = dp[i-1] + p*(1 + dp[i]) + (1-p); 解释一下: 敲出i个字符, 首先得敲出i-1个字符, 所以有第一部分的dp[i-1]; 然后敲下一个字符时, 有两种可能, p概率会丢失, (1-p)概率不会丢失, 对于丢失的情况就还得重新敲dp[i]次了(期望次数), 不丢失的原创 2016-12-19 13:27:22 · 550 阅读 · 0 评论 -
ACM这条路不好走,但还是有很多人走在这条路上
ACM这条路不好走,但还是有很多人走在这条路上。弱校里面也有ACM强者,只是这条路,异常艰辛。我只想让这个世界,听听我们的故事,听听我们的声音。真的,有了决心,有了目标,有了耐心,这才是一个人的起跑前提。我们是Acmer,如果不付出点努力,我们连参赛资格都没有,我们不想成为替补,ACM这条路,要么胆怯的放弃,不要进入这个领域,要么勇敢的踏进来,去探索我们未知的方向。ACM之路确实是一条不想再次走了路原创 2016-12-18 03:11:38 · 2040 阅读 · 6 评论 -
排序总结
排序的概念: 所谓排序,就是要整理文件中的记录,使之按关键字递增(或递减)次序排列起来。当待排序记录的关键字都不相同时,排序结果是惟一的,否则排序结果不惟一。稳定性: 在待排序的文件中,若存在多个关键字相同的记录,经过排序后这些具有相同关键字的记录之间的相对次序保持不变,该排序方法是稳定的;若具有相同关键字的记录之间的相对次序发生改变,则称这种排序方法是不稳定的。要注意的是,排序算法的稳定性是针原创 2016-11-09 00:32:03 · 931 阅读 · 0 评论 -
大二反省
比完赛回来,我在宿舍苦闷着想了七天,那种滋味真的很难受。不过在现在看来,不得不说,这是一个必须要经历的过程。这段时间我完全不知道自己该干什么,茫然失措。说是在话,我那个时候开始矛盾了。我自个早在暑假集训之前就买了很多Java跟HTML的书,很想走这方面,只不过没有来得及看。但是,另一方面,我在集训队里毕竟还是水平太低,基础不牢,而且待下的时间一年都没有,如果及早地退出不免遗憾。我开始四处访问“良医”原创 2016-10-26 11:55:25 · 682 阅读 · 2 评论 -
大一总结
“每个人都不是靠天赋,因为他们努力还不够!”我说这句话的原因是勉励自己,其实也是鞭策自己。自己是在一个弱二本念大二,刚刚过完的大一,让自己收获了许多。特别是进入集训队以来的这八个月,也许在外人看没什么,但是这个我必须得好好说一说。首先,acm是一个方向,让自己大一刚刚步入大学感到很迷茫的时候突然亮起来的一盏明灯。每个人都不应该为自己做过的选择后悔,无论结果如何。进入acm我有很辛苦地去学,谈谈我这一原创 2016-09-25 21:26:46 · 1013 阅读 · 4 评论 -
ACM之路———算法模板(基础算法)
算法模板一、DP 二、博弈 三、最小生成树 四、最短路 五、二分图匹配 六、字符串匹配 七、动态数据查询(线段树、树状数组) 八、字典树 九、强连通(tarjan) 十、LCA倍增法 十一、STL(map、优先队列、栈、堆排序) 十二、高斯消元(整型)一、基础DP类型(1)01背包 for(int i=0;i<n;i++) for(int j=m原创 2016-08-20 11:40:22 · 1385 阅读 · 0 评论 -
hdu 1849 Rabbit and Grass(Nim博弈入门)
Problem Description 大学时光是浪漫的,女生是浪漫的,圣诞更是浪漫的,但是Rabbit和Grass这两个大学女生在今年的圣诞节却表现得一点都不浪漫:不去逛商场,不去逛公园,不去和AC男约会,两个人竟然猫在寝食下棋…… 说是下棋,其实只是一个简单的小游戏而已,游戏的规则是这样的: 1、棋盘包含1*n个方格,方格从左到右分别编号为0,1,2,…,n-1; 2、m个棋子放在棋盘的原创 2016-08-20 10:19:09 · 595 阅读 · 0 评论 -
Codeforeces 703B Mishka and trip(路径权值的计算)
Little Mishka is a great traveller and she visited many countries. After thinking about where to travel this time, she chose XXX — beautiful, but little-known northern country.Here are some interesting原创 2016-08-20 10:09:44 · 497 阅读 · 0 评论 -
2015湖南省acm省赛赛题解(部分)
A题( Aerial Tramway) https://ac.2333.moe/Contest/view/id/88/problem/A.xhtml神题。。。师兄说是树形dp,我连题目都没看懂。。B题(大还是小?) https://ac.2333.moe/Contest/view/id/88/problem/B.xhtml此题颇有争论,有的人用字符串处理过了,比如我,代码有点复杂:原创 2016-08-19 20:51:50 · 1212 阅读 · 0 评论 -
ACdream 1773 最长非回文串
Problem Description回文串大家都知道是什么吧~现在给你一串字符串请求出该字符串最长的连续非回文子串的长度是多少。Input 长度不超过10^6。题目保证字符串只由小写字母a-z组成。Output 一个整数,表示最长非回文串的长度。若不存在输出-1。Sample Input AAABASample Output 5比较坑的一个题目,没有之一!!!解析:把输入的字符串做以下两种原创 2016-08-19 20:19:28 · 569 阅读 · 0 评论 -
NBUT 1670 字符串(strstr函数的处理)
Description给两个字符串p和s,如果字符串s包含了字符串p,输出字符串p在字符串s的起始位置(如果含有多个p,输出最小一个),不包含则输出-1。Input 第一行 T(表示测试数据),每个测试数据有两行,第一行s(字符长不超过1000000),第二行p(字符长不超过10000)。Output 输出p在s中最早出现的位置,如果p没有在s中出现过,输出-1.Sample Input2 a原创 2016-08-19 19:24:44 · 457 阅读 · 0 评论 -
NBUT 1217 Dinner
Description Little A is one member of ACM team. He had just won the gold in World Final. To celebrate, he decided to invite all to have one meal. As bowl, knife and other tableware is not enough in th原创 2016-08-19 19:04:16 · 546 阅读 · 0 评论 -
NBUT 1219 Time
Description Digital clock use 4 digits to express time, each digit is described by 3*3 characters (including”|”,”_”and” “).now given the current time, please tell us how can it be expressed by the dig原创 2016-08-19 18:58:37 · 482 阅读 · 0 评论 -
hdu 4712 Hamming Distance(位运算+随机函数)
Problem Description (From wikipedia) For binary strings a and b the Hamming distance is equal to the number of ones in a XOR b. For calculating Hamming distance between two strings a and b, they must原创 2016-08-19 18:49:47 · 571 阅读 · 0 评论 -
ACM之路——算法模板(数学)
在说正事之前,先说说题外话,进集训队也有将近八个月,感觉这就是一个靠数学吃饭的地方,另外还需要努力,每一道题目你解决它所花的时间跟你的进步是成正比的,路还有那么长,不过今年就要参加省赛了,剩下的时间不多,赶紧补题去!!!数学在比赛中占的比重比较大,主要是数论、公式、递推、组合、概率、矩阵、博弈等等,目前更新一部分的模板,另外一部分会马上更新,请大家不要着急。一、简单数论、特殊公式(1)素数判定boo原创 2016-08-13 15:55:05 · 2176 阅读 · 1 评论 -
hdu 2710 Max Factor
hdu 2710 Max FactorProblem Description To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortu原创 2016-08-02 18:56:04 · 415 阅读 · 0 评论 -
浅谈STL之(一) 排序函数——next_permutation(a,a+n)
首先来看一个题:POJ 1731 OrdersDescription The stores manager has sorted all kinds of goods in an alphabetical order of their labels. All the kinds having labels starting with the same letter are stored in原创 2016-08-02 18:48:23 · 1537 阅读 · 0 评论 -
8月1日解题报告
hdu 1164输入一个数,要求输出所有因子乘积的形式,并从小到大排列,数字与数字之间用“*”隔开,解决这类问题不需要素数打表,只需要用唯一分解定理即可。#include<iostream>#include<cstdio>using namespace std;int main(){ int n,m,t; while(cin>>m) { t=m;原创 2016-08-01 14:24:54 · 275 阅读 · 0 评论 -
hdu 1016 Prime Ring Problem
hdu 1016 Prime Ring ProblemProblem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent ci原创 2016-07-18 14:46:18 · 310 阅读 · 0 评论 -
POJ 1007 DNA Sorting
POJ 1007 DNA SortingDescriptionOne measure of unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequenceDAAB原创 2016-07-18 02:02:18 · 506 阅读 · 0 评论 -
hdu 2512 一卡通大冒险
解析:第二类斯特灵数、贝尔数#include<iostream>using namespace std;long long a[2005][2005]={1};long long b[2005];#define c 1000int main(){ for(int i=1;i<=2000;i++) { a[i][0]=0; a[i][i]=1原创 2016-07-18 01:24:59 · 792 阅读 · 0 评论 -
hdu 4165 Pills
Problem Description Aunt Lizzie takes half a pill of a certain medicine every day. She starts with a bottle that contains N pills.On the first day, she removes a random pill, breaks it in two halves,原创 2016-07-18 01:18:28 · 679 阅读 · 0 评论 -
骨牌铺方格升级版
Tri Tiling hdu 1143题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1143分析:首先需要想到的是分类,分类是解这个题的关键点。在2*3的格子中,铺三张骨牌有两种方式,一种是三张都横着放,另外一种是两张竖着放,剩下一张横着放,而这一种又有种放法,一种是横着放的放在上面,另一种是横着放的放在下面。因此,总共有三种放法。在4*3的原创 2016-07-17 23:40:19 · 881 阅读 · 0 评论 -
ACM新手入门历程
首先,我做个自我介绍,大一即将转入大二acm业余狗,入队七个月零25天。普通二本院校,外号皂兄。 我是偶然兴趣入了这条道儿的,刚开始只想着学学C,心里盘算着一来消磨消磨时光,二来既然选的专业属于信息类,反正都要学,何尝不先试试水,没学成,那也没事;学成了一点半点,那装装B也还是可以的。 我自己看视频敲简单程序掌握C大概用了一个多月,后来学校的师兄(我们都这样叫他,其实他是学校的原创 2016-07-12 16:18:26 · 3715 阅读 · 3 评论 -
单词数(题目很容易读错)
hdu 单词数(2072)Problem Description lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。Input 有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没有标点符号,遇到#时表示输入结束。Output 每组只输出一个整数,其单独成行原创 2016-05-10 13:45:02 · 993 阅读 · 0 评论 -
A == B ?(揭开神奇的面纱)
hdu A == B ? (2054)Problem Description Give you two numbers A and B, if A is equal to B, you should print “YES”, or print “NO”.Input each test case contains two numbers A and B.Output for each case原创 2016-05-10 13:07:44 · 1010 阅读 · 0 评论 -
hdu 2050 折线分割平面(图形递推题)
Problem Description 我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。Input 输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(n大于0且n<=10000),表示折线的数量。Outpu...原创 2016-05-09 18:19:14 · 1572 阅读 · 0 评论 -
The 3n + 1 problem
hdu The 3n + 1 problem (1032)Problem Description Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you原创 2016-05-09 17:09:24 · 773 阅读 · 0 评论 -
超级楼梯
hdu 2041 超级楼梯Problem Description 有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法?Input 输入数据首先包含一个整数N,表示测试实例的个数,然后是N行数据,每行包含一个整数M(1<=M<=40),表示楼梯的级数。Output 对于每个测试实例,请输出不同走法的数量Sample Input 2 2 3Samp原创 2016-04-25 16:21:15 · 778 阅读 · 0 评论