
ACM
yinyeqiqi
只因岁月蒙尘。
展开
-
背包问题
Problem Description简单的背包问题。设有一个背包,可以放入的重量为s。现有n(n<=10)件物品,重量分别为w1,w2,...,wn,均为正整数,从n件物品中挑选若干件,使得放入背包的重量之和正好为s。找到一组解即可。如果找不到输出“not found”。Input输入有多组数据,每组数据的第1行是物品总件数和背包的载重量,第2行为各物品的重量。 Output原创 2014-07-28 12:01:40 · 532 阅读 · 0 评论 -
Bandwidth
Bandwidth Given a graph (V,E) where V is a set of nodes and E is a set of arcs in VxV, and an ordering on the elements in V, then the bandwidth of a node vis defined as the maximum distance in the ord原创 2014-11-23 20:16:00 · 985 阅读 · 0 评论 -
X-Plosives
A secret service developed a new kind of explosive that attain its volatile property only when a speci cassociation of products occurs. Each product is a mix of two different simple compounds, to wh原创 2014-11-23 20:37:40 · 554 阅读 · 0 评论 -
Break Standard Weight
The 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 pan, also called原创 2014-12-01 17:37:48 · 535 阅读 · 0 评论 -
Java Beans
Java BeansDescriptionThere 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 consecuti原创 2014-12-14 20:46:44 · 656 阅读 · 0 评论 -
Floor problem
B - Floor problemDescriptionIn this problem, we have f(n,x)=Floor[n/x]. Here Floor[x] is the biggest integer such that no larger than x. For example, Floor[1.1]=Floor[1.9]=1, Floor[2.0原创 2014-12-14 20:29:59 · 567 阅读 · 0 评论 -
Ping pong
Ping pongDescriptionN(3N20000) ping pong players live along a west-east street(consider the street as a line segment). Each player has a unique skill rank. To improve their skill原创 2014-12-24 20:36:11 · 567 阅读 · 0 评论 -
Easy Task
You are given n integers. Your task is very easy. You should find the maximum integer a and the minimum integer b among these n integers. And then you should replace both a and bwith a-b. Your task原创 2015-02-08 13:59:58 · 689 阅读 · 0 评论 -
排列2
Problem DescriptionRay又对数字的列产生了兴趣:现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。 Input每组数据占一行,代表四张卡片上的数字(0 Output对每组卡片按从小到大的顺序输出所有能由这四张卡片组成的4位数,千位数字相同的在同一行,同一行中每个四位原创 2015-03-12 21:33:43 · 750 阅读 · 0 评论 -
Min Number
Now you are given one non-negative integer n in 10-base notation, it will only contain digits ('0'-'9'). You are allowed to choose 2 integers i and j, such that: i!=j, 1≤i<j≤|n|, here |n| means the le原创 2015-04-01 21:08:01 · 413 阅读 · 0 评论 -
等式数量
Description集合是基本的数学概念,它是集合论的研究对象。关于集合论最简单的说法,是在最原始的集合论《朴素集合论》中的定义:集合就是“一堆东西”。集合里的“东西”,叫作元素。若x是集合A中的元素,记作 x∈A。集合中的元素是互不相同的。 表示相等关系的式子叫做等式。 给你一个包含有N个整数的集合,如果从集合中找到三个不同的整数a,b,c使得a+b=c,那么我们说这个集合原创 2015-04-01 20:39:45 · 714 阅读 · 0 评论 -
Hangover
题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=10018题意:输入一个 M 当1/2 + 1/3 + 1/4 + ... + 1/(n + 1)>=M时,输出n// 打表#includedouble a[500];void fun(){ int i; for(i=1;i<原创 2015-04-01 21:02:39 · 480 阅读 · 0 评论 -
Just a Hook
In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length. No原创 2015-04-01 20:54:30 · 411 阅读 · 0 评论 -
Convert QWERTY to Dvorak
Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a broken Caps Lock key, so Edward never presses the broken Caps Lock key. Luckily, all the othe原创 2015-04-26 10:58:36 · 791 阅读 · 0 评论 -
May Day Holiday
As a university advocating self-learning and work-rest balance, Marjar University has so many days of rest, including holidays and weekends. Each weekend, which consists of Saturday and Sunday, is a原创 2015-04-26 10:49:51 · 963 阅读 · 0 评论 -
Fabled Rooks
Problem F: Fabled RooksWe would like to place n rooks, 1 ≤ n ≤ 5000, on a n×n board subject to the following restrictionsThe i-th rook can only be placed within the rectangle given by i原创 2014-11-23 20:23:07 · 486 阅读 · 0 评论 -
大魔术师
Problem DescriptionLittleMing 刚刚看了《大魔术师》这部电影,他对魔术产生了浓厚的兴趣。于是,他决定向大魔术师 BigMing学习魔术。今天, BigMing 要教给 LittleMing 的魔 术是这样的 :道 具是 13 张黑桃扑克A,2,3,4,5,6,7,8,9,10,J,Q,K。这 13 张牌预先排好,正面朝下,拿在魔术师的手里,从上面开始,第原创 2014-10-17 09:10:53 · 570 阅读 · 0 评论 -
数学
Problem Description给出数列 A1 , A2 , . . . , AN,并设Bi = (A1 * A2 · · · AN/Ai) mod (10^9 + 7)现要求把所有的 Bi 算出来。Input输入包含多组测试数据。对于每组数据,第1行, 1个整数 N(1 Output对于每组数据,输出一行,N个整数用空格分隔,表示算出的B1原创 2014-10-17 09:28:58 · 558 阅读 · 0 评论 -
cover
Problem DescriptionTom wants to cover a rectangular floor by identical L-shape tiles without overlap. As shown below, the floor can be split into many small squares, and the L-shape tile consists of原创 2014-07-30 20:29:46 · 455 阅读 · 0 评论 -
螺旋方阵
Problem DescriptionGiven an odd number n, we can arrange integers from 1 to n*n in the shape of a spiral. The figure below illustrates the spiral made by integers from 1 to 25.1 2 3 4 5 ----原创 2014-08-07 10:02:07 · 487 阅读 · 0 评论 -
求和号
Problem Description在数学运算中经常要计算连续的和。例如:计算1+2+...+n,或者等比数列a+a^2+...+a^n。这些和式通常不能够逐项完全写出,使用省略号来辅助表示也不够简洁,所以我们使用求和号"∑"来表示这类连续的和。通常在"∑"的下方标自变量名称和初始值,在"∑"的上方标终止值,而在"∑"的右方写表达式。求和号"∑"也可以嵌套使用,例如:3 2∑ ∑原创 2014-07-15 16:44:33 · 1588 阅读 · 0 评论 -
软件工程
Problem DescriptionMerlin的软件工程老师Max布置了开发一个软件的大作业。由于这是一个大型软件,所以单靠Merlin一个人不可能在预订的时间内做完,必须与其他人合作。由于大家都要做这个作业,所以Merlin理所当然找他的同班同学,但是同班同学的能力是参差不齐的。全班都很明确,这个工程可以分为n个不同的部分,每个部分都是独立,并且每个人都有一定的能力完成其中的一个部分。M原创 2014-07-17 10:49:02 · 597 阅读 · 0 评论 -
过河卒
Problem Description棋盘上A点有一个过河卒,需要走到目标B点。卒行走的规则:可以向下、或者向右。同时在棋盘上的任一点有一个对方的马(如C点),该马所在的点和所有跳跃一步可达的点称为对方马的控制点(马走日字),卒不能通过对方马的控制点。棋盘用坐标表示,A点(0,0)、B点(n, m) (n,m为不超过20的整数),同样马的位置坐标是需要给出的,C≠A且C≠B。现在要求你计算出卒原创 2014-07-30 20:22:25 · 1002 阅读 · 0 评论 -
Yu Ji
Problem DescriptionYu Ji is very annoying because he always ask others to guess his boring riddles. He will find different guys to guess his riddle for everyday. Unfortunately, he finds you to take原创 2014-07-23 08:17:11 · 523 阅读 · 0 评论 -
Single Round Match
Problem DescriptionAssociation for Couples Match (ACM) is a non-profit organization which is engaged in helping single people to find his/her other half. As November 11th is "Singles Day", on this d原创 2014-07-29 16:46:01 · 466 阅读 · 0 评论 -
SZ斐波拉契数列
Problem DescriptionFibonacci sequence is familiar to you, right? Here comes the SZ Fibonacci sequence, with the property like the following formula.F(n)= a (n=1)F(n)= b (n=2)F(n)= F(n-1)+F(n-2原创 2014-07-15 16:22:34 · 612 阅读 · 0 评论 -
奖学金
Problem Description某小学最近得到了一笔赞助,打算拿出其中一部分为学习成绩优秀的前5名学生发奖学金。期末,每个学生都有3门课的成绩:语文、数学、英语。先按总分从高到低排序,如果两个同学总分相同,再按语文成绩从高到低排序,如果两个同学总分和语文成绩都相同,那么规定学号小的同学排在前面,这样,每个学生的排序是唯一确定的。任务:先根据输入的3门课的成绩计算总原创 2014-08-28 08:24:50 · 831 阅读 · 0 评论 -
位数问题
Problem Description在所有的N位数中,有多少个数中有偶数个数字3?由于结果可能很大,你只需要输出这个答案对12345取余的值。Input输入一个数N(1Output对于每一个N输出有多少个数中有偶数个数字3。Sample Input20Sample Output73 【样例说明】在所有的2位原创 2014-09-02 15:53:36 · 2976 阅读 · 0 评论 -
病毒
Problem Description你有一个日志文件,里面记录着各种系统事件的详细信息。自然的,事件的时间戳按照严格递增顺序排列(不会有两个事件在完全相同的时刻发生)。遗憾的是,你的系统被病毒感染了,日志文件中混入了病毒生成的随机伪事件(但真实事件的相对顺序保持不变)。备份的日志文件也被感染了,但由于病毒采用的随机感染方法,主日志文件和备份日志文件在感染后可能会变得不一样。给出被转载 2014-09-03 19:15:43 · 525 阅读 · 0 评论 -
单词缩写
Problem Description我们经常用一串短的字母代替一些长的单词。如ACM是Association for Computing Machinery的缩写。现在你用取首字母的办法得到一串单词的缩写。取首字母的办法是指把每个单词的首字母取出来用大写字母表示,然后把这些大写字母拼起来。但是也有些情况是例外的:一些情况在产生缩写是会被忽略,这些特殊情况见下面的规则:1.常用的单词:原创 2014-09-03 19:12:15 · 829 阅读 · 0 评论 -
合唱队形
Problem DescriptionN位同学站成一排,音乐老师要请其中的(N-K)位同学出列,使得剩下的K位同学排成合唱队形。合唱队形是指这样的一种队形:设K位同学从左到右依次编号为1, 2, …, K,他们的身高分别为T1, T2, …, TK,则他们的身高满足T1 Ti+1 > … > TK (1≤i≤K)。你的任务是,已知所有N位同学的身高,计算最少需要几位同学出列,可以使得原创 2014-08-20 10:37:39 · 682 阅读 · 0 评论 -
Hurry Up
Problem DescriptionGG is some what afraid of his MM. Once his MM asks, he will always try his best to rush to their home. Obvious, he can run home in straight line directly. Alternatively, he ca原创 2014-09-03 19:38:33 · 500 阅读 · 0 评论 -
无聊的黑叔
Problem Description有一个很无聊的人,人称黑叔。有一天,他在草稿纸上打了一个N(1所有整数填进这些格子里。他想了以下几个规则:(1) 1可以填在任意一个位置(2) i所在的行序号等于i-1所在的列序号,2(3) 按从小到大的顺序填,每个格子只能填一个数。黑叔惊喜的发现,有时候可以把这些数都填完,有时候不行。例如下图3 4 65 9 12原创 2014-10-04 19:20:57 · 671 阅读 · 0 评论 -
最小的数
题目描述给你一个n位数,每次操作可以选该数任意的相邻两位进行交换,如果最多可以操作k次,那么最终可以得到的最小的数是什么(n位且不能含前导零)?输入有多组测试数据,第一行为数据个数T(T输出最终能得到的最小的数。样例输入2321654987 1321654987 2样例输出231654987132654987原创 2015-05-22 09:52:18 · 817 阅读 · 0 评论