sicily 1206 Stacking Cylinders

算是一道比较简单的数学题了~

 1 #include <bits/stdc++.h>
 2
 3 using namespace std;
 4
 5 double a[1005];
 6
 7 int main()
 8 {
 9     int n, t;
10     scanf("%d", &t);
11     int k=1;
12     while(t--)
13     {
14         scanf("%d", &n);
15         for(int i=0; i<n; i++)
16             scanf("%lf", &a[i]);
17         sort(a, a+n);
18         double x = (a[0] + a[n-1]) / 2;
19         double y=1;
20         for(int i=0; i<n-1; i++)
21             y += sqrt(4 - pow((a[i+1]-a[i])/2, 2));
22         printf("%d: ", k++);
23         printf("%.4lf %.4lf\n", x, y);
24     }
25
26     return 0;
27 }
时间: 2024-08-27 06:09:52

sicily 1206 Stacking Cylinders的相关文章

sicily 1012/1206 Stacking Cylinders

1206. Stacking Cylinders Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Problem Cylinders (e.g. oil drums) (of radius 1 foot) are stacked in a rectangular bin. Each cylinder on an upper row rests on two cylinders in the row below. Th

sicily 1012. Stacking Cylinders

Time Limit: 1sec    Memory Limit:32MB Description Cylinders (e.g. oil drums) (of radius 1 foot) are stacked in a rectangular bin. Each cylinder on an upper row rests on two cylinders in the row below. The cylinders in the bottom row rest on the floor

POJ2194 Stacking Cylinders(向量旋转)

题目链接: http://poj.org/problem?id=2194 题目描述: Stacking Cylinders Description Cylinders (e.g. oil drums) (of radius 1 foot) are stacked in a rectangular bin. Each cylinder on an upper row rests on two cylinders in the row below. The cylinders in the bott

编程题目分类(剪辑)

1. 编程入门 2. 数据结构 3. 字符串 4. 排序 5. 图遍历 6. 图算法 7. 搜索:剪枝,启发式搜索 8. 动态规划/递推 9. 分治/递归 10. 贪心 11. 模拟 12. 算术与代数 13. 组合问题 14. 数论 15. 网格,几何,计算几何 [编程入门] PC 110101, uva 100, The 3n+1 problem, 难度 1 PC 110102, uva 10189, Minesweeper, 难度 1 PC 110103, uva 10137, The T

(转)sicily题目分类

Sicily题目分类 ·         [数据结构/图论] 1310 Right-Heavy Tree   笛卡尔树相关,复杂度O(N)或O(NlogN). ·1426 Phone List         电话号码前缀检索,trie树相关. ·1443 Printer Queue      基本队列操作. ·1149 等价表达式         判断表达式是否等价(递归求解) ·1136 山海经             n长序列里求m次区间询问的最大连续子区间和.线段树/RMQ ·1252

HOJ 题目分类

转自:http://blog.sina.com.cn/s/blog_65f3869301011a1o.html ******************************************************************************* 简单题(包括枚举,二分查找,(复杂)模拟,基础数据结构(栈.队列),杂题等 ****************************************************************************

计算几何题目分类

转载 一.基础题目 1.1 有固定算法的题目 A, 最近点对问题最近点对问题的算法基于扫描线算法.ZOJ 2107    Quoit Design    典型最近点对问题POJ    3714    Raid    变种最近点对问题 B,最小包围圆最小包围圆的算法是一种增量算法,期望是O(n).ZOJ    1450    Minimal Circle  HDU    3007    Buried memory C,旋转卡壳POJ 3608    Bridge Across Islands   

Ensemble_learning 集成学习算法 stacking 算法

原文:https://herbertmj.wikispaces.com/stacking%E7%AE%97%E6%B3%95 stacked 产生方法是一种截然不同的组合多个模型的方法,它讲的是组合学习器的概念,但是使用的相对于bagging和boosting较少,它不像bagging和boosting,而是组合不同的模型,具体的过程如下:1.划分训练数据集为两个不相交的集合.2. 在第一个集合上训练多个学习器.3. 在第二个集合上测试这几个学习器4. 把第三步得到的预测结果作为输入,把正确的回

hzau 1206 MathematicalGame

1206: MathematicalGame Time Limit: 2 Sec  Memory Limit: 1280 MBSubmit: 124  Solved: 15[Submit][Status][Web Board] Description Xiao Ming likes to play mathematical games very much. One day, he gets a sequence of n positive integers. XOR (l , r) is def