URAL 1457. Heating Main
space=1&num=1457">1457. Heating Main
Memory limit: 64 MB
Background
students escaping the army, retirees hunting for empty bottles, extremely nice vagrants and amiable young people wearing black caps, leather jackets and baseball bats - all of them are so close to me.
some old man. The foundations of market economy are impossible to resist.
is going to live a worth old age. Thank the government and the President for such a great concern.
at the clinic, provide himself with foodstuffs at the market dump, get a pension at the post-office or give this pension to the grandson - it is just enough to buy an ice cream!
Problem
between any two points of the heating main equals to the absolute value of the difference between their main offsets.
the heating main through these gulleys only. If he tries to use another gulley, he would be immediately caught by watchful policemen as a dangerous vagrant.
efforts to reach each of the places is minimal.
Input
Output
Sample
| input | output |
|---|---|
3 |
5.333333 |
Problem Author: Nikita Rybak, Dmitry Kovalioff, Ilya Grebnov
Problem Source: Timus Top Coders: Second Challenge
解析:ans = sum(P[i]) / n
AC代码:
#include <bits/stdc++.h>
using namespace std; int main(){
int n, x;
while(~scanf("%d", &n)){
int sum = 0;
for(int i=0; i<n; i++){
scanf("%d", &x);
sum += x;
}
printf("%.6lf\n", (double)sum / n);
}
return 0;
}
URAL 1457. Heating Main的更多相关文章
- [高斯消元] POJ 2345 Central heating
Central heating Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 614 Accepted: 286 Des ...
- poj 2345 Central heating
Central heating Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 678 Accepted: 310 Des ...
- NBUT 1457 莫队算法 离散化
Sona Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Submit Status Practice NBUT 145 ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
- ural 2068. Game of Nuts
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...
- ural 2067. Friends and Berries
2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...
随机推荐
- 求最长回文子串,O(n)复杂度
最长回文子串问题-Manacher算法 最长回文串问题是一个经典的算法题. 0. 问题定义 最长回文子串问题:给定一个字符串,求它的最长回文子串长度. 假设一个字符串正着读和反着读是一样的,那它就是回 ...
- 鸟书shell 学习笔记(二) shell中正則表達式相关
通配符与正則表達式的差别 通配符是bash原生支持的语法,正則表達式是处理字符串的一种表示方式, 正則表達式须要支持的工具支持才干够 语系设置 : export LANG=C grep alias 设 ...
- JavaScript 中对变量和函数声明提前的演示样例
如题所看到的,看以下的演示样例(能够使用Chrome浏览器,然后F12/或者右键,审查元素.调出开发人员工具,进入控制台console输入)(使用技巧: 控制台输入时Shift+Enter能够中途代码 ...
- JavaScript AMD规范简单介绍(一)
AMD是"Asynchronous Module Definition"的缩写.意思就是"异步模块定义". AMD定义了我们所用的模块都是是异步载入的,所以我们 ...
- 希尔加密算法(湖南师范大学第六届大学生计算机程序设计竞赛)hnuoj11552
解密 Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB Total submit users: 2, Accept ...
- js 获取手机浏览器类型,修改css文件的class的值
/*========================================= 函数功能:获取浏览器类型 =========================================*/ ...
- word2010无法显示endnote x7插件及破解endnote x7
最近本人由于要写文章需要使用endnotex7,相比于mendeley和noteexpress,文献管理和引用我喜欢endnote x7,阅读喜欢mendeley.可是由于之前用的正版30天到期了,破 ...
- Oracle 查看锁定表用户的SQL
#描述:当执行如下SQL select * From XXX for Updata 发现表“XXX”被锁定 #只需要执行如下SQL 查看锁定该表的用户 SELECT object_name, mach ...
- 初涉springboot
1.首先,我们需要了解微服务是什么? 微服务 (Microservices) 是一种软件架构风格,它是以专注于单一责任与功能的小型功能区块 (Small Building Blocks) 为基础,利用 ...
- idea报错:Please, configure Web Facet first!
https://blog.csdn.net/handsomepig123_/article/details/87257689 转载