URAL 1902 Neo-Venice(简单物理相遇问题)_Sun_AC的博客-程序员宅基地

技术标签: URAL  

1902. Neo-Venice

Time limit: 1.0 second
Memory limit: 64 MB
Mars was the first planet colonized by humans. After a long terraforming process its appearance has changed completely. From the red desert it has become a blue planet covered by water. There was so much water that some of the cities were built not on land, but on stilts over the water. The most famous one was Neo-Venice. There are canals instead of roads and numerous gondolas instead of cars in this city. All this attracts huge crowds of tourists from the Earth to Neo-Venice. The most popular activities among them are boat excursions. Gondolas are steered by young girls who can not only bring tourists through the canals but also tell them about the history of the city or sing a song along the way. Due to their love for the water these girls are called undines.
The undine Anna has just received a license to steer a gondola. Tomorrow she will carry tourists on excursion to the St. Peter's canal. This canal is narrow, but many popular routes are passing through it, so there are always a lot of gondolas. Anna is afraid that her excitement may lead to a crash with another gondola during the excursion. However, all undines are trained to steer the gondola smoothly and with the same speed, so the only threat comes from gondolas sailing in the opposite direction. Anna knows the schedule of her colleagues and when she herself will enter the canal. Now she wants to know exactly when she will encounter other gondolas, in order to be extra careful around them.

Input

The first line of the input contains integers  nt and  sn is the number of undines who will go through the St. Peter’s canal in the opposite direction (1 ≤  n ≤ 100).  t is the time needed for the gondola to sail through the entire length of the canal (1 ≤  t ≤ 100).  s is the moment of time at which the Anna's gondola will enter the canal (360 ≤  s ≤ 1200). The second line contains integers  s 1, …,  s n that define the moments of time at which the gondolas of Anna’s colleagues will appear on the opposite side of the canal.  s −  t <  s 1 < … <  s n <  s +  t.

Output

Output  n numbers that are the points of time when Anna will meet her colleagues, with absolute or relative error no more than 10 −6. Numbers should be separated with spaces or line feeds.

Sample

input output
2 60 600
600 630
630.000000
645.000000
AC代码:
#include <stdio.h>
int main(){
	int n,t,s,a;
	double tt;
	scanf("%d%d%d",&n,&t,&s);
	while(n--){
		scanf("%d",&a);
		tt=(s+t+a)/2.0;
		printf("%.6lf\n",tt);
	}
	return 0;
}


版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/YJX_xx/article/details/38010983

智能推荐

3572: [Hnoi2014]世界树_spzb的博客-程序员宅基地

链接这题显然是虚树,建出虚树后,先求出每个虚节点被谁支配。这个可以两边dfs求出,第一遍从儿子转移到父亲,第二遍从父亲到儿子然后对每条边考虑,如果被两个点被同一个点支配,显然这点加上siz[u]-siz[t]不然可以直接算出中间点的深度,倍增向上跳就可以了还有不在虚树上的子树,要单独计算#include &amp;amp;lt;cstdio&amp;amp;gt;#include &amp;amp;lt;vector&amp;amp;gt;...

教程 Redis+ flask+vue 在线聊天_flask vue 聊天模板_十一月的萧邦。的博客-程序员宅基地

知识点基于 Server-Sent Event 工作方式,Web 即时通信Redis 包 发布订阅功能的使用flask 快速入门,常用对象实例方法函数Vuejs 列表页面自动渲染效果图app.py 主文件import datetimefrom flask import Flask, session, redirect, Response, request, render_temp...

这段惊世骇俗的代码强在哪里?_weixin_33756418的博客-程序员宅基地

有人说代码不在于多,在于精。程序员每天和代码打交道,要是能写出一段代码,看起来很牛逼,那简直是很开心的一件事情。有网友在网络上分享了一段代码,还问网友说这段惊世骇俗的代码强在什么地方,谁能看得懂?关于这段代码,很多网友称看不懂,不知道什么意思。当然,网友中也是有牛人的,下面两位网友,就分享了自己的看法:网友一:网友二:这段牛逼的代码,到底强在哪里,这算是有了答案。不过这...

python resample函数_python – pandas resample文档_weixin_39656513的博客-程序员宅基地

B business day frequencyC custom business day frequency (experimental)D calendar day frequencyW weekly frequencyM month end frequencySM semi-month end fr...

C# winform帧动画_winform 帧动画_葉飞纷飞的博客-程序员宅基地

字符动画个人觉得更具挑战性,可惜没那么多时间和精力来独自研究。本文示例 利用系统线程实现将图片轮播配上音乐还原视屏原效果。功能包括暂停播放,继续播放. 另外本示例以 Bad Apple为例。将视屏每帧转成图片,网上工具很多,可以网上搜索一下。using System;using System.Collections.Generic;using System.ComponentModel;us...

SpringCloud之Eureka客户端的注册_桐花思雨的博客-程序员宅基地

目录前言`eureka` 客户端的注册前言在 上一篇 文章中完成了 eureka 集群的搭建,本篇文章将实现 eureka 客户端的注册行为eureka 客户端的注册依然使用上一篇文章的项目,继续创建 2 个子模块,作为 eureka 的客户端进行注册,如下...

随便推点

java 统计字符串中字符个数_java统计字符串中字符及子字符串个数_weixin_39851457的博客-程序员宅基地

import java.util.Scanner;public class Counter {static Scanner scanner = new Scanner(System.in);public static void count(String s) {int low, upper, num, others;low = upper = num = others = 0;for (int i...

iOS:tableView刷新闪烁问题解决_ios uitablview 刷新闪烁_零点零一的博客-程序员宅基地

我做的是直播消息系统,每当有人评论、送礼物、第一次点赞直播消息列表都要及时显示。就像这样原来思路是这样的:图中红框是我们的消息列表,是一个tableView,每个消息是一个cell,每次接收到一条消息立刻添加到数据数组中,同时刷新tableView,滚动到底部。原来的代码是这样写的: [chatDataArray addObject:chatModel]; [chatTable re

markdown编辑使用Data URL实现图片内嵌,解决拷贝文档图片丢失的问题_markdown内嵌图片_德大神的博客-程序员宅基地

1首先,图片img标签的src属性值就是Data Url。这里可以用html网页的一段代码对应的工具,实现生成图片对应的DATA URL。我这里用简单的txt文档工具,编写代码,如下:dataurl.txt 复制如下代码:&lt;!DOCTYPE html&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;&lt;head&gt;&lt;meta http-equiv="Content-Type" content="text...

git 创建本地分支 切换本地分支 合并本地分支_wjm0519的博客-程序员宅基地

1.查看本地分支 git branch2.创建本地分支并切换到分支 git checkout -b 分支名称3.创建分支 git branch 分支名称4.切换分支 git checkout 分支名称5.将分支合并到当前分支,先git checkout 当前分支 ,然后在git merge 需要合并的分支注:a,也可以远程新建分支然后拉到本地(例如:远程分支是demo)git checkout -b demo origin/demo //检出...

BGP协议的具体属性(华为面试官问)_bgp的tcp连接以谁为准_N1314N的博客-程序员宅基地

2、BGP协议特性:1、BGP是自治系统外部路由协议,用来在AS之间传递路由信息2、路径矢量路由协议,从设计上避免了环路的发生其路由信息中携带了所经过的全部AS路径列表。这样,接收该路由信息的BGP路由器可以明确的知道此路由信息是否源于自己的AS。如果是源于自己的AS,BGP就会丢弃此条路由,这样就根本的解决了AS之间产生环路的可能。3、TCP承载,端口号是179天然的可靠传输机制...

SpringMVC介绍_springmvc 模块介绍_小布丁value的博客-程序员宅基地

SpringMVC介绍SpringMVC介绍SpringMVC的运行原理SpringMVC的使用1、依赖jar包2、在web.xml中配置前端控制器3、创建SpringMVC的配置文件4、编写controller层5、编写jsp页面日志分析1、日志依赖2、日志配置文件3、日志打印数据插入示例mapper.java接口文件mapper.xml文件删除数据示例修改数据示例mapper.xml配置文件SpringMVC介绍SpringMVC是属于是spring中web模块的支持一部分实现的了WEB MVC的

推荐文章

热门文章

相关标签