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. ...
随机推荐
- java连接数据库核心代码
一.oracle String driver = "oracle.jdbc.driver.OracleDriver"; String url = "jdbc:Oracle ...
- HDU 3861--The King’s Problem【scc缩点构图 && 二分匹配求最小路径覆盖】
The King's Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- Dalvik和ART简单介绍
1.classes.dex文件初识 我们先把QQ_236.apk后缀改为QQ_236.zip,然后解压.发现有一个classes.dex文件,这个classes.dex是java源代码编译后生 ...
- php静态函数的使用场景
php静态函数的使用场景 场景 代码 <?php class Conductor{ public static $i = 100; public function sold(){ $a = se ...
- Extjs 可重用组件开始写 2014 8 23日
今天开始自己去写组件. 这次写组件重点在于参考cfWeb来写出自己的组件. 首先先把结构做出来. 对于这次的自定义组件,现在所做的事情关键在于上面四个文件.于是将上面四个文件贴出来. MyApp.js ...
- ROS常用知识指南
前言:介绍一些基础常用的知识. 一.标准单位 二.坐标表现方式 三.默认安装位置 通过apt-get安装的软件包, 默认安装位置为:/opt/ros/kinetic/share 四.软件包安装流程 4 ...
- ros中文术语表及消息类型表
前言:整理一些ros常用表格,包括中文术语对照表. 一.中文术语表 二.消息类型表 -END-
- Java Servlet 配置
图片太大,可以右键另存再查看,也可以鼠标点击拖置一下,用浏览器单独承载放大查看.
- onmouse事件与mouse事件
1.mouse是js,onmouse是html的,其实差别就是加了一个on 2.mouse事件:鼠标移动时:1>会有冒泡的:mouseover ,mouseout 2>没有事件冒泡的: m ...
- java同步锁的正确使用
同步锁分类 对象锁(this) 类锁(类的字节码文件对象即类名.class) 字符串锁(比较特别) 应用场景 在多线程下对共享资源的安全操作. 需求:启动5个线程对共享资源total进行安全操作. 同 ...