2013寒假ACM集训
文章平均质量分 73
代码是块糖
来自SDUT计院学生一枚。个人主页:http://www.ihypo.net
展开
-
背包九讲笔记-完全背包问题
基本思路完全背包就是01背包的变化,所有的物件不再是单一的,而有无限个,可以先用01背包的思路,让所有的每种物品都装尽量多,那么我们可以获得状态转移方程:F[i,v] = max{F[i − 1,v],F[i − 1,v − kCi] + kWi| 0 ≤ kCi≤ v}或者是:F[i,v] = max{F[v],F[v − kCi] + kWi| 0 ≤ kCi≤ v}(优化原创 2014-02-12 13:51:36 · 701 阅读 · 0 评论 -
2014寒假ACM集训13级PK赛-翻转排序
翻转排序Time Limit: 1000MS Memory limit: 65536K题目描述给你一组正整数,请编写一个程序把每个整数翻转,然后按升序排序输出,翻转后前面的零要消掉。输入第一个整数n(1≤n≤106)表明有多少个数字需要处理,接下来是n个整数。整数已空格分开,每行可以有任意多的整数。输入的整数≤1012。输出n行排好序的整数。原创 2014-03-09 21:44:33 · 621 阅读 · 0 评论 -
2014ACM集训13级PK赛2-Guess the Price
DescriptionIn the television program "Shopping Street" of CCTV-2, two people, A and B are guessing price of a given item. You are asked to decide whose price is closer to the real price.原创 2014-03-09 22:04:29 · 854 阅读 · 0 评论 -
2014ACM集训13级PK赛2-Wu Xing
DescriptionIntroductionThe Wu Xing, or the Five Movements, Five Phases or Five Steps/Stages, are chiefly an ancient mnemonic device, in many traditional Chinese fields.The doctrine of five pha原创 2014-03-09 22:01:42 · 1072 阅读 · 0 评论 -
2014ACM集训13级PK赛2-An Awful Problem
DescriptionIn order to encourage Hiqivenfin to study math, his mother gave him a sweet candy when the day of the month was a prime number. Hiqivenfin was happy with that. But several days later, h原创 2014-03-09 21:58:14 · 793 阅读 · 0 评论 -
2014ACM集训13级PK赛2-Somali Pirates
DescriptionIt is said that the famous Somali Pirates hate digits. So their QQ passwords never contain any digit. Given some lines of candidate passwords, you are asked to delete all the digits in原创 2014-03-09 21:55:48 · 777 阅读 · 0 评论 -
2014ACM集训13级PK赛3-Density of Power Network
DescriptionThe vast power system is the most complicated man-made system and the greatest engineering innovation in the 20th century. The following diagram shows a typical 14 bus power system. In原创 2014-03-10 22:13:47 · 862 阅读 · 0 评论 -
2014ACM集训13级PK赛3-Taxi Fare
DescriptionLast September, Hangzhou raised the taxi fares.The original flag-down fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after the first 3km and 3 yuan per kilometer after 10k原创 2014-03-10 22:03:13 · 908 阅读 · 0 评论 -
2014ACM集训13级PK赛3-Java Beans
DescriptionThere are N little kids sitting in a circle, each of them are carrying some java beans in their hand. Their teacher want to select M kids who seated in M consecutive seats and collect原创 2014-03-10 22:18:12 · 588 阅读 · 0 评论 -
2014ACM集训13级PK赛3-Friends
DescriptionAlice lives in the country where people like to make friends. The friendship is bidirectional and if any two person have no less than kfriends in common, they will become friends in sev原创 2014-03-10 22:15:17 · 667 阅读 · 0 评论 -
2014ACM集训13级PK赛3-Modular Inverse
DescriptionThe modular modular multiplicative inverse of an integer a modulo m is an integer x such that a-1≡x (mod m). This is equivalent toax≡1 (mod m).InputThere are multiple te原创 2014-03-10 22:07:45 · 611 阅读 · 0 评论 -
2014ACM集训13级PK赛3-Break Standard Weight
DescriptionThe balance was the first mass measuring instrument invented. In its traditional form, it consists of a pivoted horizontal lever of equal length arms, called the beam, with a weighing p原创 2014-03-10 22:11:13 · 638 阅读 · 0 评论 -
2014ACM集训13级PK赛3-Draw Something Cheat
DescriptionHave you played Draw Something? It's currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You need to pick原创 2014-03-10 22:06:06 · 747 阅读 · 0 评论 -
2014ACM集训13级PK赛3-Hard to Play
DescriptionMightyHorse is playing a music game called osu!.After playing for several months, MightyHorse discovered the way of calculating score in osu!:1. While playing osu!, player need原创 2014-03-10 22:16:32 · 674 阅读 · 0 评论 -
2014ACM集训13级PK赛3-Yet Another Story of Rock-paper-scissors
DescriptionAkihisa and Hideyoshi were lovers. They were sentenced to death by the FFF Inquisition. Ryou, the leader of the FFF Inquisition, promised that the winner of Rock-paper-scissors would be原创 2014-03-10 22:09:45 · 708 阅读 · 0 评论 -
2138 图结构练习——BFSDFS——判断可达性
题目描述 在古老的魔兽传说中,有两个军团,一个叫天灾,一个叫近卫。在他们所在的地域,有n个隘口,编号为1..n,某些隘口之间是有通道连接的。其中近卫军团在1号隘口,天灾军团在n号隘口。某一天,天灾军团的领袖巫妖王决定派兵攻打近卫军团,天灾军团的部队如此庞大,甚至可以填江过河。但是巫妖王不想付出不必要的代价,他想知道在不修建任何通道的前提下,部队是否可以通过隘口及其相关通道到达近卫军团展开攻原创 2014-02-19 20:09:43 · 859 阅读 · 0 评论 -
2107 图的深度遍历
题目描述请定一个无向图,顶点编号从0到n-1,用深度优先搜索(DFS),遍历并输出。遍历时,先遍历节点编号小的。输入输入第一行为整数n(0 输出输出有n行,对应n组输出,每行为用空格隔开的k个整数,对应一组数据,表示DFS的遍历结果。示例输入14 40 10 20 32 3示例输出0 1 2 3提示代码#incl原创 2014-02-19 13:21:10 · 652 阅读 · 0 评论 -
2014ACM集训13级PK赛2-Javabeans
DescriptionJavabeans are delicious. Javaman likes to eat javabeans very much.Javaman has n boxes of javabeans. There are exactly i javabeans in the i-th box (i = 1, 2, 3,...n). Everyday Javaman原创 2014-03-09 22:09:30 · 924 阅读 · 0 评论 -
2014ACM集训13级PK赛2-Median
DescriptionA median is described as the numeric value separating the higher half of a list, from the lower half. The median of a finite list of numbers can be found by arranging all the elements f原创 2014-03-09 22:10:36 · 894 阅读 · 0 评论 -
2014ACM集训13级PK赛2-Kagome Kagome
DescriptionKagome kagome, kago no naka no tori waItsu itsu deyaru? Yoake no ban niTsuru to kame to subetta.Ushiro no shoumen daare?Translation:Kagome kagome, the bird in the cage,when w原创 2014-03-09 22:08:13 · 976 阅读 · 0 评论 -
背包九讲笔记-01背包问题
基本思想与动规类似,把大问题分解,把因为求第i个物品放入背包的获利会受到第i-1个物品的影响,因此,需要考虑其影响,即考虑第i-1个物品获利。然后在剩余空间允许的情况下,再考虑将第i个物品放入后的获利并与前比较,这样,就获得了状态转移方程:F[i,v] = max{F[i − 1,v],F[i − 1,v − Ci] + Wi}。这样的常规思路需要一个DP二维数组来记录(以体积为标准)原创 2014-02-12 13:16:28 · 998 阅读 · 1 评论 -
2014ACM集训13级PK赛5-Give Me the Number
DescriptionNumbers in English are written down in the following way (only numbers less than109 are considered). Numberabc,def,ghi is written as "[abc] million [def] thousand[ghi]". Here "[xy原创 2014-03-16 20:02:56 · 633 阅读 · 0 评论 -
2014ACM集训13级PK赛5- Accurately Say "CocaCola"!
DescriptionIn a party held by CocaCola company, several students stand in a circle and play a game.One of them is selected as the first, and should say the number 1. Then they continue to coun原创 2014-03-16 19:48:21 · 821 阅读 · 0 评论 -
2014ACM集训13级PK赛4-Light Bulb
DescriptionCompared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow and he has only one light bulb in his house. Every night, he is wandering in his incom原创 2014-03-15 21:51:19 · 809 阅读 · 0 评论 -
2014ACM集训13级PK赛4-K-Nice
DescriptionThis is a super simple problem. The description is simple, the solution is simple. If you believe so, just read it on. Or if you don't, just pretend that you can't see this one.We s原创 2014-03-15 21:25:28 · 685 阅读 · 0 评论 -
2014ACM集训13级PK赛4-A Stack or A Queue?
DescriptionDo you know stack and queue? They're both important data structures. A stack is a "first in last out" (FILO) data structure and a queue is a "first in first out" (FIFO) one.Here com原创 2014-03-15 21:17:04 · 710 阅读 · 0 评论 -
2014ACM集训13级PK赛4-Second-price Auction
DescriptionDo you know second-price auction? It's very simple but famous. In a second-price auction, each potential buyer privately submits, perhaps in a sealed envelope or over a secure connectio原创 2014-03-15 21:08:54 · 853 阅读 · 0 评论 -
2014ACM集训13级PK赛5-Faster, Higher, Stronger
DescriptionIn the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China and Beijing Olympics is to be a festival for people all over the world as wel原创 2014-03-16 19:59:51 · 675 阅读 · 0 评论 -
2014ACM集训13级PK赛5-Easy Task
DescriptionCalculating the derivation of a polynomial is an easy task. Given a function f(x) , we use (f(x))' to denote its derivation. We use x^n to denote xn. To calculate the derivation of a po原创 2014-03-16 19:54:55 · 708 阅读 · 0 评论 -
2014ACM集训13级PK赛5-Build The Electric System
DescriptionIn last winter, there was a big snow storm in South China. The electric system was damaged seriously. Lots of power lines were broken and lots of villages lost contact with the main pow原创 2014-03-16 19:51:32 · 1137 阅读 · 0 评论 -
2014寒假ACM集训13级PK赛-最佳拟合直线
最佳拟合直线Time Limit: 1000MS Memory limit: 65536K题目描述在很多情况下,天文观测得到的数据是一组包含很大数量的序列点图象,每一点用x值和y值定义。这就可能需要画一条通过这些点的最佳拟合曲线。为了避免只对个别数据分析,需要进行最佳曲线拟合。考虑N个数据点,它们的坐标是(X1,Y1),(X2,Y2)...,(XN,YN)。假设原创 2014-03-09 21:48:18 · 700 阅读 · 0 评论 -
2014寒假ACM集训13级PK赛-购买矿石
购买矿石Time Limit: 1000MS Memory limit: 65536K题目描述作为一家矿石采购商,每月都要从国际市场上采购一批矿石,由于资源日益紧缺,矿石的价格几乎每月都上涨,由于国内市场因素,矿石不能一次采购太多,否则卖不出去,公司就会亏损。今天公司制定了一个采购计划,计划在未来的4个月内采购 A, B, C, D 共4个品种的矿石各一批,原创 2014-03-09 21:46:20 · 783 阅读 · 0 评论 -
2014ACM集训13级PK赛2-Ordinal Numbers
DescriptionOrdinal numbers refer to a position in a series. Common ordinals include zeroth, first, second, third, fourth and so on. Ordinals are not often written in words, they are written using原创 2014-03-09 22:05:51 · 914 阅读 · 0 评论 -
2014ACM集训13级PK赛4-80ers' Memory
DescriptionI guess most of us are so called 80ers, which means that we were born in the 1980's. This group of people shared a lot of common memories. For example, the Saint Seiya, the YoYo ball, t原创 2014-03-15 21:14:09 · 571 阅读 · 0 评论 -
2014ACM集训13级PK赛2-Conic Section
DescriptionThe conic sections are the nondegenerate curves generated by the intersections of a plane with one or two nappes of a cone. For a plane perpendicular to the axis of the cone, a circle i原创 2014-03-09 22:06:56 · 1095 阅读 · 0 评论 -
2014ACM集训13级PK赛2-Who is Older?
DescriptionJavaman and cpcs are arguing who is older. Write a program to help them.InputThere are multiple test cases. The first line of input is an integer T (0 T T test cases原创 2014-03-09 21:53:21 · 839 阅读 · 0 评论 -
1150 Message Flood 【字典树】
题目描述Well, how do you feel about mobile phone? Your answer would probably be something like that "It's so convenient and benefits people a lot". However, If you ask Merlin this question on the New Ye原创 2014-02-18 15:07:24 · 577 阅读 · 0 评论 -
Immediate Decodability 字典树
DescriptionAn encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol. We will assume for this problem that all codes原创 2014-02-18 16:50:32 · 621 阅读 · 0 评论 -
Keep on Truckin'
DescriptionBoudreaux and Thibodeaux are on the road again . . ."Boudreaux, we have to get this shipment of mudbugs to Baton Rouge by tonight!""Don't worry, Thibodeaux, I already checked ah原创 2014-01-28 23:47:59 · 700 阅读 · 0 评论 -
Average is not Fast Enough!
DescriptionA relay is a race for two or more teams of runners. Each member of a team runs one section of the race. Your task is to help to evaluate the results of a relay race.You have to pr原创 2014-01-28 23:31:13 · 894 阅读 · 0 评论