热门 最新 精选 话题 上榜
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月前
33阅读
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月前
30阅读
牛奶问题描述 伊格内修斯每天喝牛奶,现在他在超市里,他想选择一瓶牛奶。在超市有许多种类的牛奶,所以伊格内修斯想知道哪种牛奶是最便宜的。这里有一些规则: 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月前
6阅读
伊格内修斯的难题问题描述 伊格内修斯数学很差,他落在一个谜问题,所以他别无选择,只能对艾迪的吸引力。这个问题描述: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月前
5阅读
# 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月前
10阅读
# 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月前
28阅读
# include <iostream># include <vector># include <list># include <algorithm>using namespace std;//class absInt{// public :// int operator() (int val){//// }//};//与上面的等价struct
# include <iostream># include <queue># include <list># include <deque> using namespace std;/* 队列(queue): 先进先出 定义: queue<int,deque<int> > q;
# include <iostream># include <queue># include <vector># include <deque> using namespace std;/* 优先级队列(priority_queue) 最大值优先级队列,最小值优先级队列 自适应容器 priority_queue
输出最多的颜色Input Input contains multiple test cases. Each test case starts with a number N (0 < N <= 1000) – the total number of balloons distributed. The next N lines contain one color each. The c
原创 1月前
26阅读
​​http://acm.hdu.edu.cn/showproblem.php?pid=2079​​选课时间(题目已修改,注意读题)Problem Description 又到了选课的时间了,xhd看着选课表发呆,为了想让下一学期好过点,他想知道学n个学分共有多少组合。你来帮帮他吧。(xhd认为一样学分的课没区别)Input 输入数据的第一行是一个数据T,表示有T组数据。 每组数据的第一行是
​​http://acm.hdu.edu.cn/showproblem.php?pid=2072​​单词数lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。Input 有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没有标点符号,遇到#时表示输入结束。Outp
找单词​​http://acm.hdu.edu.cn/showproblem.php?pid=2082​​Problem Description 假设有x1个字母A, x2个字母B,….. x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,….. 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值<=50的单词呢?单词的价值就是组成一个单词的所有字母的价值之和,比如,单词
原创 1月前
5阅读
=
原创 1月前
23阅读
杭电2073
汉诺塔1 :a上面的盘子借助b到c公式:n = 2^n-1;# include <iostream># include <cstdio>using namespace std;void f(int n,char A,char B,char C){ if(n>=1){ f(n-1,A,C,B);//n-1个盘子从a-->b借助c
Square CoinsProblem Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=1
原创 1月前
32阅读
在数学中,某个序列的母函数(Generating function,又称生成函数)是一种形式幂级数,其每一项的系数可以提供关于这个序列的信息。使用母函数解决问题的方法称为母函数方法。 母函数可分为很多种,包括普通母函数、指数母函数、L级数、贝尔级数和狄利克雷级数。对每个序列都可以写出以上每个类型的一个母函数。构造母函数的目的一般是为了解决某个特定的问题,因此选用何种母函数视乎序列本身的特性和问题