11. Convert Speed Units / Programming Fundamentals
Дава 0%! В условието пише float? В тестът който показва judge , разликата е в първия ред (m/s)
вместо 8.130082 получава 8.130081
https://judge.softuni.bg/Contests/Practice/Index/206#10
Това е кодът за 0%:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _11.Convert_Speed_Units
{
class Program
{
static void Main(string[] args)
{
double distanceMetrs = double.Parse(Console.ReadLine());
double distanceKm = distanceMetrs / 1000.0;
double distanceInMiles = distanceMetrs / 1609.0;
double hours= double.Parse(Console.ReadLine());
double minutes= double.Parse(Console.ReadLine());
double seconds= double.Parse(Console.ReadLine());
double timeHoursToSeconds = (double)hours * 3600.0;
double timeMinutesToSeconds = (double)minutes * 60.0;
double timeSumInSeconds = (double)timeHoursToSeconds + timeMinutesToSeconds + seconds;
double timeSumInHours = (double)timeSumInSeconds / 3600.0;
double metersPerSecond = distanceMetrs / timeSumInSeconds;
double kilometersPerHour = distanceKm / timeSumInHours;
double milesPerHour = distanceInMiles / timeSumInHours;
Console.WriteLine("{0:F6}", metersPerSecond);
Console.WriteLine("{0:F5}", kilometersPerHour);
Console.WriteLine("{0:F5}", milesPerHour);
}
}
}