摘要: Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0#define max 200001typedef struct{//树的结点 int l; //左端点 int r; //右端点 int m; //记录l~r之间的,最大数。}point;point ... 阅读全文
posted @ 2014-04-05 16:51 段少 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Problem Description有如下方程:Ai= (Ai-1+ Ai+1)/2 - Ci(i = 1, 2, 3, .... n).若给出A0, An+1, 和 C1, C2, .....Cn.请编程计算A1= ?Input输入包括多个测试实例。对于每个实例,首先是一个正整数n,(n int main(){ int n,i; double a,c,sum; while(scanf("%d",&n)!=EOF) { scanf("%lf",&a); sum=n*a; scanf("%lf",&a); su 阅读全文
posted @ 2014-03-15 23:50 段少 阅读(127) 评论(0) 推荐(0) 编辑
摘要: Problem Description这次xhd面临的问题是这样的:在一个平面内有两个点,求两个点分别和原点的连线的夹角的大小。注:夹角的范围[0,180],两个点不会在圆心出现。Input输入数据的第一行是一个数据T,表示有T组数据。每组数据有四个实数x1,y1,x2,y2分别表示两个点的坐标,这些实数的范围是[-10000,10000]。Output对于每组输入数据,输出夹角的大小精确到小数点后两位。Sample Input21 1 221 1 1 0Sample Output0.0045.00本题的思路是先计算出每个点的斜率,然后转化为角度,两个角度相减即可,有可能不在[0,180]这个 阅读全文
posted @ 2014-03-15 22:28 段少 阅读(317) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThere are many lamps in a line. All of them are off at first. A series of operations are carried out on these lamps. On the i-th operation, the lamps whose numbers are the multiple of i change the condition ( on to off and off to on ).InputEach test case contains only a number n ( 阅读全文
posted @ 2014-03-15 15:40 段少 阅读(325) 评论(0) 推荐(0) 编辑
摘要: Problem Description不死族的巫妖王发工资拉,死亡骑士拿到一张N元的钞票(记住,只有一张钞票),为了防止自己在战斗中频繁的死掉,他决定给自己买一些道具,于是他来到了地精商店前.死亡骑士:"我要买道具!"地精商人:"我们这里有三种道具,血瓶150块一个,魔法药200块一个,无敌药水350块一个."死亡骑士:"好的,给我一个血瓶."说完他掏出那张N元的大钞递给地精商人.地精商人:"我忘了提醒你了,我们这里没有找客人钱的习惯的,多的钱我们都当小费收了的,嘿嘿."死亡骑士:"......" 阅读全文
posted @ 2014-03-08 23:58 段少 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!"人们纷纷来到告示前,都想知道谁才是自己的另一半.告示如下:数字N的因子就是所有比N小又能被N整除的所有正整数,如12的因子有1,2,3,4,6.你想知道你的另一半吗?Input输入数据的第一行是一个数字T(1int main(){ int t,n,i,sum; scanf("%d",&t); while(t--) { sum=1; scanf("%d",&n); for(i=2;i 阅读全文
posted @ 2014-03-08 22:57 段少 阅读(92) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThe Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 #include#includeint s[32767],num=1;bool u[32767];void preper(){ int i,j; memset(u,true,sizeof(u)); for(i=2;i32767) break; u[i*s[j]]=false; if(i%... 阅读全文
posted @ 2014-01-21 21:10 段少 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionEverybody in the Prime Land is using a prime base number system. In this system, each positive integer x is represented as follows: Let {pi}i=0,1,2,... denote the increasing sequence of all prime numbers. We know that x > 1 can be represented in only one way in the form of prod 阅读全文
posted @ 2014-01-21 20:45 段少 阅读(400) 评论(0) 推荐(0) 编辑
摘要: Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。Input测试输入包含若干测试用例。每个测试用例的第1行给出评估的道路条数 N、村庄数目M ( #includeusing namespace std;typedef struct{ int st,ed; int len;}enodge;int cmp(enodge a,enodge b){ return ... 阅读全文
posted @ 2014-01-09 13:05 段少 阅读(205) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university believe in. You know that there are n students in your university (0 int father[50001 阅读全文
posted @ 2014-01-08 17:15 段少 阅读(173) 评论(0) 推荐(0) 编辑