摘要: 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) 编辑