
acm
MU__LE
这个作者很懒,什么都没留下…
展开
-
绝对值排序 HDU - 2020
输入n(n<=100)个整数,按照绝对值从大到小排序后输出。题目保证对于每一个测试实例,所有的数的绝对值都不相等。Input输入数据有多组,每组占一行,每行的第一个数字为n,接着是n个整数,n=0表示输入数据的结束,不做处理。 Output对于每个测试实例,输出排序后的结果,两个数之间用一个空格隔开。每个测试实例占一行。Sample Input3 3 -4 24 0 1 2 -30Sam...原创 2018-02-27 19:28:30 · 296 阅读 · 0 评论 -
奇数阶魔方 HDU - 1998
一个 n 阶方阵的元素是1,2,...,n^2,它的每行,每列和2条对角线上元素的和相等,这样 的方阵叫魔方。n为奇数时我们有1种构造方法,叫做“右上方” ,例如下面给出n=3,5,7时 的魔方. 3 8 1 6 3 5 7 4 9 2 5 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 7 30 39 48 1 ...原创 2018-02-27 20:37:34 · 287 阅读 · 0 评论 -
奇数阶魔方(II) HDU - 2183
1 ,2, 3, …,n^2 这n^2 个数 排成n*n 方阵 每行每列每条对角线上的n个数字之和s相等, s=n(n*n+1)/2,奇数阶魔方可由菱形转变成 n=3,5时如下 3 *********1 ******4******2 ***7*****5******3 ******8******6 *********9 4 9 2 3 5 7 8 1 6 5 *******************...原创 2018-02-27 21:11:06 · 238 阅读 · 0 评论 -
三角形 HDU - 1249
用N个三角形最多可以把平面分成几个区域? Input输入数据的第一行是一个正整数T(1<=T<=10000),表示测试数据的数量.然后是T组测试数据,每组测试数据只包含一个正整数N(1<=N<=10000).Output对于每组测试数据,请输出题目中要求的结果. Sample Input212Sample Output28题解:an=3*(n-1)*n+2;推理如下:...原创 2018-02-27 21:42:43 · 143 阅读 · 0 评论 -
QQ Aizu - 0000
Write a program which prints multiplication tables in the following format:1x1=11x2=2..9x8=729x9=81InputNo input.Output1x1=11x2=2..9x8=729x9=81Template for C#include<stdio.h>int ma...原创 2018-02-27 22:11:56 · 314 阅读 · 0 评论 -
List of Top 3 Hills Aizu - 0001
There is a data which provides heights (in meter) of mountains. The data is only for ten mountains.Write a program which prints heights of the top three mountains in descending order.InputHeight of mo...原创 2018-02-27 22:24:40 · 217 阅读 · 0 评论 -
距离之和最小 51Nod - 1096
X轴上有N个点,求X轴上一点使它到这N个点的距离之和最小,输出这个最小的距离之和。Input第1行:点的数量N。(2 <= N <= 10000) 第2 - N + 1行:点的位置。(-10^9 <= Pii <= 10^9)Output输出最小距离之和Sample Input5-1-3079Sample Output20题解:排序取中间值即可;(用c++方便些,...原创 2018-03-14 22:50:00 · 286 阅读 · 0 评论 -
符号三角形 HDU - 2510
符号三角形的 第1行有n个由“+”和”-“组成的符号 ,以后每行符号比上行少1个,2个同号下面是”+“,2个异 号下面是”-“ 。计算有多少个不同的符号三角形,使其所含”+“ 和”-“ 的个数相同 。 n=7时的1个符号三角形如下: + + - + - + + + - - - - + - + + + - - + + - - + - - - + Input每行1个正整数n <=24,n=0退出...原创 2018-02-28 20:50:32 · 1457 阅读 · 1 评论 -
循环小数 HRBUST - 1120
大家还记得小学奥数那个神奇的问题么?循环小数0.9999…等于1.但是可能还有一部分同学不理解,它的证明方法有很多,在这里给出一种最简单容易理解的证明办法,当你AC了这道题你也就明白了他的证明方法了Input输入数据只有一个正整数N(0<N<10)当N=0时候输入结束Output输出循环小数0.NNNNNNN…所表示的分数形式(化简成最简形式)Sample Input93Sample ...原创 2018-02-28 21:04:58 · 490 阅读 · 0 评论 -
最小公倍数LCM 51Nod - 1012
输入2个正整数A,B,求A与B的最小公倍数。Input2个数A,B,中间用空格隔开。(1<= A,B <= 10^9)Output输出A与B的最小公倍数。Sample Input30 105Sample Output210题解:注意用long long即可;代码(C语言)#include <stdio.h>#include <stdlib.h>long long...原创 2018-03-08 20:54:27 · 210 阅读 · 0 评论 -
Pie HDU - 1969
My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of ...原创 2018-03-01 12:43:00 · 195 阅读 · 0 评论 -
正整数分组 51Nod - 1007
将一堆正整数分为2组,要求2组的和相差最小。例如:1 2 3 4 5,将1 2 4分为1组,3 5分为1组,两组和相差1,是所有方案中相差最少的。Input第1行:一个数N,N为正整数的数量。 第2 - N+1行,N个正整数。 (N <= 100, 所有正整数的和 <= 10000)Output输出这个最小差Sample Input512345Sample Output1题解...原创 2018-03-01 19:58:58 · 170 阅读 · 0 评论 -
正整数分组 V2 51Nod - 1128
给出一个长度为N的正整数数组,不改变数组元素的顺序,将这N个数分为K组。各组中元素的和分别为S1,S2....Sk。如何分组,使得S1至Sk中的最大值最小?例如:1 2 3 4 5 6分为3组,{1 2 3} {4 5} {6},元素和为6, 9, 6,最大值为9。也可以分为{1 2 3 4} {5} {6}。元素和为:10 5 6,最大值为10。因此第一种方案更优。并且第一种方案的最大值是所有方...原创 2018-03-01 21:15:38 · 293 阅读 · 0 评论 -
连续整数的和 51Nod - 1138
给出一个正整数N,将N写为若干个连续数字和的形式(长度 >= 2)。例如N = 15,可以写为1 + 2 + 3 + 4 + 5,也可以写为4 + 5 + 6,或7 + 8。如果不能写为若干个连续整数的和,则输出No Solution。Input输入1个数N(3 <= N <= 10^9)。Output输出连续整数中的第1个数,如果有多个按照递增序排列,如果不能分解为若干个连续整...原创 2018-03-17 20:47:29 · 198 阅读 · 0 评论 -
最小公倍数 HDU - 1108
给定两个正整数,计算这两个数的最小公倍数。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。 Sample Input10 14Sample Output70题解:水题;代码(C语言)#include <stdio.h>#include <stdlib.h>int lcm(...原创 2018-03-12 22:59:07 · 303 阅读 · 0 评论 -
最小公倍数 SCU - 1630
求N个正整数的最小公倍数。输入 第一行为一个数M,表示测试数据的组数,接下来有M行,每行为一组测试数据。 每组测试数据由若干个整数组成,第一个数为N,表示紧接着有N个数,接下来有N个正整数。输出 对于每组测试数据,输出一行,即这N个数的最小公倍数。 可以保证所有的测试数据及其最后的运算结果都在32位有符号整型数(即C++中的int)的范围内。输入示例23 5 7 15...原创 2018-03-12 23:06:31 · 225 阅读 · 0 评论 -
相等的最小公倍数 HRBUST - 1328
定义An为1,2,…,n的最小公倍数,例如,A1 = 1,A2 = 2,A3 = 6,A4 = 12,A5 = 60,A6 = 60。请你判断对于给出的任意整数n,An是否等于An – 1。Input本题有多组测试数据,输入的第一行是一个整数T代表着测试数据的数量,接下来是T组测试数据。对于每组测试数据:第1行 包含一个整数n (2 ≤ n ≤ 106)。Output对于每组测试数据:第1行 如果...原创 2018-03-12 23:28:48 · 238 阅读 · 0 评论 -
小学生的游戏 FZU - 1575
某天,无聊的小斌叫上几个同学玩游戏,其中有比较笨的小兴,比较傻的小雪,可爱的小霞和自以为是的小楠。他们去找聪明的小明去给他们当裁判。判定谁取得游戏胜利。而这个游戏是由小斌想个1到10000000的数字让大家猜,看谁先猜中。为了防止小斌作弊,小明记录下了游戏的整个过程。你的任务是判断小斌是否有作弊。Input输入数据包括多盘游戏。一次猜数包含两行,第一行是一个数字n(1<=n<=1000...原创 2018-03-13 22:10:54 · 186 阅读 · 0 评论 -
水仙花数 51Nod - 1015
水仙花数是指一个 n 位数 ( n >= 3 ),它的每个位上的数字的 n 次幂之和等于它本身。(例如:1^3 + 5^3 + 3^3 = 153)给出一个整数M,求 >= M的最小的水仙花数。Input一个整数M(10 <= M <= 1000)Output输出>= M的最小的水仙花数Sample Input99Sample Output153题解:先写一个代码求[...原创 2018-03-13 22:34:53 · 261 阅读 · 0 评论 -
四边形分割平面 51Nod - 2000
用N个四边方形最多可以把平面分成几个区域?Input第一行输入一个整数T,表示数据组数(1<=T<=10000); 第二行输入一个正整数n(1<=n<=1000);Output对于每组数据,请输出结果。Sample Input212Sample Output210题解:通项公式为an=4n2−4n+2;#include <stdio.h>#include...原创 2018-03-21 21:26:22 · 247 阅读 · 0 评论 -
不容易系列之(3)―― LELE的RPG难题
人称“AC女之杀手”的超级偶像LELE最近忽然玩起了深沉,这可急坏了众多“Cole”(LELE的粉丝,即"可乐"),经过多方打探,某资深Cole终于知道了原因,原来,LELE最近研究起了著名的RPG难题: 有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的方格不能同色,且首尾两格也不同色.求全部的满足要求的涂法. 以上就是著名的RPG难...原创 2018-07-08 21:50:31 · 983 阅读 · 0 评论 -
A + B
读入两个小于100的正整数A和B,计算A+B. 需要注意的是:A和B的每一位数字由对应的英文单词给出. Input测试输入包含若干测试用例,每个测试用例占一行,格式为"A + B =",相邻两字符串有一个空格间隔.当A和B同时为0时输入结束,相应的结果不要输出. Output对每个测试用例输出1行,即A+B的值. Sample Inputone + two =three four + five ...原创 2018-07-08 23:02:11 · 205 阅读 · 0 评论 -
stl 的 map
Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will cou...原创 2018-07-23 21:26:33 · 92 阅读 · 0 评论 -
stl 的 map
Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius want ...原创 2018-07-23 21:28:10 · 138 阅读 · 0 评论 -
stl 的 map
夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了. Input第一行正整数N(0<N<=10)表示有N组测试数据. 每组测试数据的第一行是一个整数M(0<M<=100),表示工有M次成功的交易.其后有M行数据,每...原创 2018-07-23 21:29:34 · 97 阅读 · 0 评论 -
New Year Bonus Grant
All programmers of Mocrosoft software company are organized in a strict subordination hierarchy. Every programmer has exactly one chief, except Bill Hates who is also the head of the company and has n...原创 2018-07-23 22:06:04 · 169 阅读 · 0 评论 -
贪心
FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean. The warehouse has N rooms. The i-th room contains J[i] pounds of Ja...原创 2018-07-24 10:49:40 · 125 阅读 · 0 评论 -
递推
我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。 Input输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(0<n<=10000),表示折线的数量。 Output对于每个测试实例,请输出平面...原创 2018-07-24 11:05:43 · 289 阅读 · 0 评论 -
贪心
Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after th...原创 2018-07-24 15:28:26 · 110 阅读 · 0 评论 -
贪心
When playing DotA with god-like rivals and pig-like team members, you have to face an embarrassing situation: All your teammates are killed, and you have to fight 1vN. There are two key attributes fo...原创 2018-07-24 16:28:55 · 157 阅读 · 0 评论 -
The 3n + 1 problem
Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose ...原创 2018-07-06 19:23:47 · 190 阅读 · 0 评论 -
请使用sort
Football is one of the greatest games in the world. Lots of people like to play football. After one season of matches, the header has to calculate the last scores of every team. He is too lazy that he...原创 2018-07-24 19:49:18 · 180 阅读 · 0 评论 -
请使用sort
Soon after he decided to design a T-shirt for our Algorithm Board on Free-City BBS, XKA found that he was trapped by all kinds of suggestions from everyone on the board. It is indeed a mission-impossi...原创 2018-07-24 19:59:19 · 307 阅读 · 0 评论 -
stl 的 优先队列
Because of the wrong status of the bicycle, Sempr begin to walk east to west every morning and walk back every evening. Walking may cause a little tired, so Sempr always play some games this time. Th...原创 2018-07-24 20:37:15 · 119 阅读 · 0 评论 -
Bitset
Give you a number on base ten,you should output it on base two.(0 < n < 1000)InputFor each case there is a postive number n on base ten, end of file.OutputFor each case output a number o...原创 2018-07-24 21:07:55 · 237 阅读 · 0 评论 -
Candy Sharing Game
A number of students sit in a circle facing their teacher in the center. Each student initially has an even number of pieces of candy. When the teacher blows a whistle, each student simultaneously giv...原创 2018-07-06 21:55:51 · 426 阅读 · 0 评论 -
Edge
For products that are wrapped in small packings it is necessary that the sheet of paper containing the directions for use is folded until its size becomes small enough. We assume that a sheet of paper...原创 2018-07-06 23:04:48 · 164 阅读 · 0 评论 -
A + B Again
There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too. Easy ? AC it !...原创 2018-07-24 21:29:47 · 240 阅读 · 0 评论 -
Specialized Four-Digit Numbers
Find and list all four-digit numbers in decimal notation that have the property that the sum of its four digits equals the sum of its digits when represented in hexadecimal (base 16) notation and also...原创 2018-07-25 09:01:39 · 1203 阅读 · 0 评论 -
The Circumference of the Circle
To calculate the circumference of a circle seems to be an easy task - provided you know its diameter. But what if you don't? You are given the cartesian coordinates of three non-collinear points in t...原创 2018-07-25 09:21:04 · 242 阅读 · 0 评论