1902. Neo-venice
Time limit:1.0 Second
Memory limit:64 MB
Mars is the first planet colonized by humans. After a long terraforming process it appearance has changed completely. From the red desert it had become a blue planet covered by water. There is so much water that some of the cities were built is not on land, but on stilts over the water. The most famous one is Neo-venice. There is canals instead of roads and numerous gondolas instead of cars in the city. All this attracts huge crowds of tourists from the Earth to Neo-venice. The most popular activities among them is boat excursions. Gondolas is steered by young girls who can isn't only bring tourists through the canals but also tell themabout the history Of the city or sing a song along the. Due to their love for the water these girls is called Undines. The Undine Anna has just received a license to steer a gondola. Tomorrow she'll carry tourists on excursion to the St. Peter's Canal. This canal was narrow, but many popular routes was passing through it, so there was always aLot of gondolas. Anna is afraid this excitement may leads to a crash with another gondola during the excursion. However, all Undines is trained to steer the gondola smoothly and with the same speed, so the only threat comes from Gond Olas sailing in the opposite direction. Anna knows the schedule of hers colleagues and when she herself would enter the canal. Now she wants to know exactly when she'll encounter other gondolas, in order to be extra careful around them.InputThe first line of the input contains integers n, t and S. N are the number of undines who'll go through the St. Peter's C Anal 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 for time at which the Anna's gondola would 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 w Ill appear on the opposite side of the canal. S−t < s 1 < ... < s n < s + T.OutputOutput n numbers that is the points of time when Anna would meet her colleagues, with absolute or relative error no more t Han 10−6. Numbers should is separated with spaces or line feeds.Sample
input |
Output |
2
600 630
|
630.000000
645.000000
|
problem Author:Denis Dublennykh
problem Source:Ural Championship 2012
Parse: Calculates the time of encounter with n reverse vessels. Direct calculation.
AC Code:
#include <bits/stdc++.h>
using namespace std;
int s[102];
int main () {
int N, T, S;
scanf ("%d%d%d", &n, &t, &s);
for (int i=0; i<n; i++) scanf ("%d", &s[i]);
for (int i=0; i<n; i++) printf ("%.6lf\n", (double) (S + s[i] + T)/2);
return 0;
}