热门 最新 精选 话题 上榜
排序Problem Description 输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’组成的,这时这个整数就是0)。你的任务是:对这些分割得到的整数,依从小到大的顺序排序输出。Input 输入包含多组测试用例,每组输入数据只有一行数字(数字之间没有空格),这
原创 1月前
6阅读
# include <iostream># include <cstdio># include <algorithm>using namespace std;int main(){ int n,a[10009]; int i,t; while(scanf("%d",&n),n!=0){ int t = 1;
原创 1月前
66阅读
背包问题难度:3 描述 现在有很多物品(它们是可以分割的),我们知道它们每个物品的单位重量的价值v和重量w(1<=v,w<=10);如果给你一个背包它能容纳的重量为m(10<=m<=20),你所要做的就是把物品装到背包里,使背包里的物品的价值总和最大。 输入 第一行输入一个正整数n(1<=n<=5),表示有n组测试数据; 随后有n测试数据,每组测试数据
原创 1月前
72阅读
吃糖果Problem Description HOHO,终于从Speakless手上赢走了所有的糖果,是Gardon吃糖果时有个特殊的癖好,就是不喜欢将一样的糖果放在一起吃,喜欢先吃一种,下一次吃另一种,这样;可是Gardon不知道是否存在一种吃糖果的顺序使得他能把所有糖果都吃完?请你写个程序帮忙计算一下。Input 第一行有一个整数T,接下来T组数据,每组数据占2行,第一行是一个整数N(0
原创 1月前
59阅读
The calculation of GPATime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 24013 Accepted Submission(s): 5610Problem Description 每学期的期末,大家都会忙于计算自己的平均
原创 1月前
70阅读
# include <iostream># include <cstdio>using namespace std;int main(){ char a[5][7],t; int n,m,i,j,k; int cases = 0; char modol[1001]; while(gets(a[0])){ if(a[0][0]=='
原创 1月前
54阅读
18岁生日Problem Description Gardon的18岁生日就要到了,他当然很开心,可是他突然想到一个问题,是不是每个人从出生开始,到达18岁生日时所经过的天数都是一样的呢?似乎并不全都是这样,所以他想请你帮忙计算一下他和他的几个朋友从出生到达18岁生日所经过的总天数,让他好来比较一下。Input 一个数T,后面T行每行有一个日期,格式是YYYY-MM-DD。如我的生日是1988
原创 1月前
74阅读
院大学生程序设计竞赛(新生为主) 寒冰王座Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 13570 Accepted Submission(s): 6899Problem Description 不死族的巫妖王发工资拉,死亡骑士拿到一张
骨收集器​​http://acm.hdu.edu.cn/showproblem.php?pid=2602​​问题描述许多年前,在泰迪的家乡有一个叫“拾骨者”的人。这个人喜欢收集不同的骨头,比如狗,牛,他还去了坟墓… 骨收集器有一大袋的体积V,以及访问收集有很多骨头,很明显,不同的骨骼有不同的价值和不同的体积,现在考虑到每个骨头的价值以及他的旅行,你能计算出最大的总价值骨头收集器可以得到什么?输入
原创 1月前
61阅读
回文数猜想Problem Description 一个正整数,如果从左向右读(称之为正序数)和从右向左读(称之为倒序数)是一样的,这样的数就叫回文数。任取一个正整数,如果不是回文数,将该数与他的倒序数相加,若其和不是回文数,则重复上述步骤,一直到获得回文数为止。例如:68变成154(68+86),再变成605(154+451),最后变成1111(605+506),而1111是回文数。于是有数学家
原创 1月前
77阅读
Reverse NumberProblem Description Welcome to 2006’4 computer college programming contest!Specially, I give my best regards to all freshmen! You are the future of HDU ACM! And now, I must tell you tha
原创 1月前
54阅读
Piggy-BankProblem Description Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (
原创 1月前
74阅读
测试你是否和LTC水平一样高Problem Description 大家提到LTC都佩服的不行,不过,如果竞赛只有这一个题目,我敢保证你和他绝对在一个水平线上! 你的任务是: 计算方程x^2+y^2+z^2= num的一个正整数解。Input 输入数据包含多个测试实例,每个实例占一行,仅仅包含一个小于等于10000的正整数num。Output 对于每组测试数据,请按照x,y,z递增的顺序
原创 1月前
52阅读
杭电1407--暴力与优化
Basically Speaking​​http://acm.hdu.edu.cn/showproblem.php?pid=1335​​Problem Description The Really Neato Calculator Company, Inc. has recently hired your team to help design their Super Neato Model I
原创 1月前
69阅读
A Simple TaskProblem Description Given a positive integer n and the odd integer o and the nonnegative integer p such that n = o2^p.ExampleFor n = 24, o = 3 and p = 3.TaskWrite a program which for eac
原创 1月前
51阅读
利用矢量叉积判断是逆时针还是顺时针。 设A(x1,y1),B(x2,y2),C(x3,y3),则三角形两边的矢量分别是: AB=(x2-x1,y2-y1), AC=(x3-x1,y3-y1) 则AB和AC的叉积为:(2*2的行列式) |x2-x1, y2-y1| |x3-x1, y3-y1| 值为:(x2-x1)*(y3-y1) - (y2-y1)*(x3-x1
原创 1月前
122阅读
Big Event in HDUProblem Description Nowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don’t know that Computer College had ever been split into Computer Col
# include <cstdio> # include <cstdlib># include <iostream># include <ctime>using namespace std; /* 生成n个不同的数 min代表最小值 max生成的最大值 */ int CreateData(int arr[],int n,int
原创 1月前
65阅读
数塔 在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗?Input 输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1 <= N <= 100),表示数塔的高度,接下来用N行数字表示数塔,其中
二者都是从终端读入字符串。功能为1、 gets功能为读入一行,并将换行符转换为字符串结束符。2、 scanf("%s",s);读入时,遇到空白字符,包括空格,制表符,换行符时均会停止输入。从功能上可以看出不同之处:1 终止条件不同。gets只有遇到\n时才会结束输入,而scanf遇到空格或制表符时,也会结束输入。比如输入"test string\n"。用gets得到的字符串为"test strin
原创 1月前
65阅读
A1 = ?Problem Description 有如下方程:Ai = (Ai-1 + Ai+1)/2 - Ci (i = 1, 2, 3, …. n). 若给出A0, An+1, 和 C1, C2, …..Cn. 请编程计算A1 = ?Input 输入包括多个测试实例。 对于每个实例,首先是一个正整数n,(n <= 3000); 然后是2个数a0, an+1.接下来的n行每行有
原创 1月前
67阅读
# include <iostream># include <cstdio>using namespace std;int main(){int n,i,j;double a[2],b[50000],k;while(cin>>n){cin>>a[0]>>a[1];for(i=0;i<n;i++){cin>>b[i];}
原创 1月前
46阅读
The Hardest Problem Ever​​http://acm.hdu.edu.cn/showproblem.php?pid=1048​​Problem Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping
原创 1月前
49阅读
整数解Problem Description 有二个整数,它们加起来等于某个整数,乘起来又等于另一个整数,它们到底是真还是假,也就是这种整数到底存不存在,实在有点吃不准,你能快速回答吗?看来只能通过编程。 例如: x + y = 9,x * y = 15 ? 找不到这样的整数x和y 1+4=5,1*4=4,所以,加起来等于5,乘起来等于4的二个整数为1和4 7+(-8)=-1,7*(-8
原创 1月前
47阅读
A Mathematical CuriosityProblem Description Given two integers n and m, count the number of pairs of integers (a,b) such that 0 < a < b < n and (a^2+b^2 +m)/(ab) is an integer.This problem c
原创 1月前
32阅读
Uniform GeneratorProblem Description Computer simulations often require random numbers. One way to generate pseudo-random numbers is via a function of the formseed(x+1) = [seed(x) + STEP] % MODwhere
原创 1月前
38阅读
The 3n + 1 problemProblem 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 will be anal
原创 1月前
36阅读
Rightmost DigitProblem Description Given a positive integer N, you should output the most right digit of N^N.Input The input contains several test cases. The first line of the input is a single inte
原创 1月前
36阅读
Humble Numbers​​http://acm.hdu.edu.cn/showproblem.php?pid=1058​​​ Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8,
原创 1月前
30阅读
一个简单的任务问题描述 伊格内修斯出生在一个闰年,所以他想知道他什么时候可以举行他的生日晚会。你能告诉他吗?给定一个正整数Y标明一开始,和一个正整数N,你的任务是告诉每年的第N个闰年Y。注意:如果Y是一个闰年,那么第一闰年是Y。输入 输入包含多个测试用例。输入的第一行是一个整数T测试用例的数量。T测试用例。 每个测试用例包含两个正整数Y和(1 < = N < = 10000)。输
原创 1月前
28阅读