随笔分类 - 假期训练
摘要:A - The Trip, 2007 小包可以放在打包里,求最少的数量。 做法就是求出现相同数字最多的。 B - Partitioning by Palindromes 传送 C - Seek the Name, Seek the Fame The little cat is so famous,
阅读全文
摘要:A - Fence Repair Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤
阅读全文
摘要:最小的数 Problem Description 定义一种正整数集合K,集合中有N个数,集合中元素Ki(1<=i<=N)是包含i个不同质因子的最小的数。因为Ki可能会很大,所以将集合中所有Ki对10^9+7取余。 Input 本题只有唯一一组测试数据,第一行给出N,q,表示K的个数以及q次询问。1<
阅读全文
摘要:A UVA - 10954 将n个数合并成一个数,每次合并的价值是两个数的和,求最小的总和价值。 优先队列。 B - Calendar Game Description Adam and Eve enter this year's ACM International Collegiate Progr
阅读全文
摘要:A Robot Description The Robot Moving Institute is using a robot in their local store to transport different items. Of course the robot should spend on
阅读全文
摘要:A Add More Zero There is a youngster known for amateur propositions concerning several mathematical hard problems.Nowadays, he is preparing a thought-
阅读全文
摘要:A UVA - 725 输入一个数n求是否有abcde/fghij=n,abcdefghij都是不同的数字,有的全部输出,没有的就按格式输出。 暴力可以做时间为10!。 BHDU - 2546 电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或
阅读全文
摘要:New Skateboard Max wants to buy a new skateboard. He has calculated the amount of money that is needed to buy a new skateboard. He left a calculator o
阅读全文
摘要:POJ 3225 题 意 : 区 间 操 作 , 交 , 并 , 补 等 思 路 : 我 们 一 个 一 个 操 作 来 分 析 :( 用 0 和 1 表 示 是 否 包 含 区 间 , - 1 表 示 该 区 间 内 既 有 包 含 又有 不 包 含 ) U : 把 区 间 [l,r ] 覆 盖
阅读全文
摘要:A - Hello World! 求最小的粘贴次数,有个坑,小于0结束,以为是等于-1结束,错了几次。 B - Building designing 排个序就行了 C - Common Subsequence 最长子串,可以不连续的。 D - The Triangle 简单的DP,不过一开始用递归超
阅读全文
摘要:POJ - 2528 离散化是将有用的信息提取出来,在区间很大的时候,用直接用线段树肯定会超时,但由于在区间内很大值是没有用到的,只把有用的区间提取出来再用线段数做就方便多了。
阅读全文
摘要:成段更新就是在一个区域内进行操作,主要是要用lazy标记。 HDU - 1698 POJ - 3468
阅读全文
摘要:单点更新,其实就是对一个点进行更新。 HDU 1166 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #define lson l,m,rt<<1 5 #define rson m+1,r,rt<<1|1 6 u
阅读全文
摘要:Guessing Camels Jaap, Jan, and Thijs are on a trip to the desert after having attended the ACM ICPC World Finals 2015 in Morocco. The trip included a
阅读全文
摘要:Ultra-QuickSort Ultra-QuickSort In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct
阅读全文
摘要:BST Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root node is X,
阅读全文
摘要:A Number Sequence 求b序列在a序列出现的次数,KMP模板题: 1 #include <iostream> 2 #include <string.h> 3 #include <stdio.h> 4 char str[10010],str1[1000010]; 5 int nex[10
阅读全文
摘要:Gym - 100952A 水题,看谁的时间少谁就赢了,不然就是平局。 B HDU - 5752 错了好几次,算出来五个if就是错,用下for就对了。 CUESTC - 1599 n张图片,和成一个图片,每次合成消耗的值为两个图片社保值之和,优先队列一直取出来两个在放进去一个,直到只有一个图片就OK
阅读全文
摘要:A - Sort it 选择排序或冒泡排序下就行,看交换的次数。(如果数量很多时可以用树状数组来求逆对数) B - Cup 就这题卡主了,数学差写了一个小时多都没有写出来,赛后发现有R>=r这个条件,可惜比赛时没有看到,想复杂了。 二分就可以做出来。 C - 又见GCD 水题,可就是W了一次,不知咋
阅读全文
摘要:逃离迷宫HDU - 1728 主要是要记录转弯的次数。
阅读全文