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. ...
随机推荐
- Storm同时接收多个源(spout和bolt)
参考: http://blog.csdn.net/nyistzp/article/details/51483779
- 数据挖掘算法学习(一)K-Means算法
博主近期实习開始接触数据挖掘,将学习笔记分享给大家.眼下用的软件是weka.下篇文章会着重解说. 转载请附上链接http://blog.csdn.net/iemyxie/article/details ...
- POJ 3905 Perfect Election(2-sat)
POJ 3905 Perfect Election id=3905" target="_blank" style="">题目链接 思路:非常裸的 ...
- tensorflow利用预训练模型进行目标检测(三):将检测结果存入mysql数据库
mysql版本:5.7 : 数据库:rdshare:表captain_america3_sd用来记录某帧是否被检测.表captain_america3_d用来记录检测到的数据. python模块,包部 ...
- 10.QT程序框架与connect
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setup ...
- Tomcat 初探(三)多项目部署
起因 昨天房东找我说最近物价飞涨,要涨我房租,混不下去了,得要求老板涨工资.一大清早就去找老板,老板看了看我,让我发布先两个网站:一个前台网站 frontend,给用户用:一个后台管理网站 backe ...
- JavaScript系列--浅析原型链与继承
一.前言 继承是面向对象(OOP)语言中的一个最为人津津乐道的概念.许多面对对象(OOP)语言都支持两种继承方式::接口继承 和 实现继承 . 接口继承只继承方法签名,而实现继承则继承实际的方法.由于 ...
- 火狐浏览器下载文件中文乱码,文件名中的空格变加号("+")的问题
解决一下问题: 1.火狐浏览器下载文件,中文变乱码 2.IE浏览器下载文件,丢失文件扩展名或强制扩展名为".txt" 3.浏览器下载文件,文件名中的空格变成加号("+&q ...
- 编程范式(Programming Paradigm)-[ 程序员的编程世界观 ]
编程范式(Programming Paradigm)是某种编程语言典型的编程风格或者说是编程方式.随着编程方法学和软件工程研究的深入,特别是OO思想的普及,范式(Paradigm)以及编程范式等术语渐 ...
- poj2406 Power Strings (kmp 求最小循环字串)
Power Strings Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 47748 Accepted: 19902 ...