热门 最新 精选 话题 上榜
回文数猜想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月前
55阅读
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月前
70阅读
测试你是否和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月前
53阅读
利用矢量叉积判断是逆时针还是顺时针。 设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月前
108阅读
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月前
63阅读
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月前
66阅读
# 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月前
39阅读
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月前
29阅读
牛奶问题描述 伊格内修斯每天喝牛奶,现在他在超市里,他想选择一瓶牛奶。在超市有许多种类的牛奶,所以伊格内修斯想知道哪种牛奶是最便宜的。这里有一些规则: 1。伊格内修斯永远不会喝牛奶生产6天前或更早。这意味着如果牛奶生产2005-1-1,伊格内修斯永远不会喝这瓶后2005-1-6(包容)。 2。伊格内修斯每天喝200毫升牛奶。 3所示。如果牛奶瓶子里剩下不到200毫升,伊格内修斯会扔掉它。
艰难的难题问题描述 lcy给难题很难feng5166,库工作小组将会忠实地JGShining和伊格内修斯:把a和b,如何知道^ b。每个人都反对这个BT的问题,所以lcy问题比开始更容易。 这个谜题描述:a和b,如何知道^ b的最后一位数字。但每个人都懒得去解决这个问题,所以他们汇你是明智的。输入 有多种测试用例。每个测试用例由a和b两个数字(0 < a、b < = 2 ^ 30
原创 1月前
4阅读
伊格内修斯的难题问题描述 伊格内修斯数学很差,他落在一个谜问题,所以他别无选择,只能对艾迪的吸引力。这个问题描述:f(x)= 5 * x ^ 13 + 13 * x ^ 5 + k * * x,输入一个nonegative整数k(k < 10000),找到最小nonegative整数,使任意整数x,65 | f(x) 不存在,然后打印“不”。输入 输入包含多个测试用例。每个测试用例由n
# include <iostream># include <set>using namespace std;/* set(集)-->不重复 multiset(多集) -->允许重复 红黑数(熟读快) 大数据使用方便,自动排序 缺点:插入慢 不能通过find进行修改 *///声明一个函数模板 template <
# include <iostream># include <map># include <string>using namespace std;/* map(映射)-->键不允许重读 multimap(多映射) -->键允许重复 红黑树 自动依靠key排序 基本操作 insert coun
# include <iostream># include <set>using namespace std;//宏定义 typedef set<int> SETINT;int main(){ SETINT a; a.insert(23); a.insert(-1); a.insert(78); a.insert(100);
原创 1月前
3阅读
# include <iostream># include <list>using namespace std; void PrintListContents(const list<int> & listInput);int main(){ list<int> a; a.push_front(4); a.push_front
原创 1月前
11阅读
# include <iostream># include <set>using namespace std;typedef multiset<int> MSETINT;int main(){ MSETINT a; a.insert(67); a.insert(88); a.insert(88); a.insert(123);
原创 1月前
40阅读
# include <iostream># include <stack># include <vector># include <list># include <deque> using namespace std;/* 栈(stack) 后进先出 自适应容器 操作: empry-->
原创 1月前
26阅读