Софтуерно Инженерство
Loading...
+ Нов въпрос
Misixty avatar Misixty 0 Точки

7. Световен рекорд по плуване - Помощ 70/100

Не разбирам къде ми е проблема,ако някой ми помогне ще съм му много благодарен.

Когато тествам кода всичко ми е ОК, но в Judge ми дава 70/100...?!

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp30
{
    class Program
    {
        static void Main(string[] args)
        {
            double recordtime = double.Parse(Console.ReadLine());
            double distanceinmaters = double.Parse(Console.ReadLine());
            double timeinsec = double.Parse(Console.ReadLine());

            double totalsec = distanceinmaters * timeinsec;
            double delaysec = Math.Floor(distanceinmaters / 15) * 12.5;

            double totalsectime = totalsec + delaysec;

            if (totalsec < recordtime)
            {
                Console.WriteLine($"Yes, he succeeded! The new world record is {totalsectime:F2} seconds.");
            }
            else
            {
                Console.WriteLine($"No, he failed! He was {totalsectime - recordtime:F2} seconds slower.");
            }
        }
    }
}

Тагове:
0
Programming Basics with C# 23/01/2020 10:49:07
kkaraivanov avatar kkaraivanov 262 Точки
Best Answer

Заповядай! Грешката ти беше в проверката, грешна променлива подаваш

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp30
{
    class Program
    {
        static void Main(string[] args)
        {
            double recordTime = double.Parse(Console.ReadLine());
            double distanceInMeters = double.Parse(Console.ReadLine());
            double timeInSec = double.Parse(Console.ReadLine());

            double totalSec = distanceInMeters * timeInSec;
            double delaySec = Math.Floor(distanceInMeters / (double)15);
            delaySec *= 12.5;

            double totalSecTime = totalSec + delaySec;

            if (totalSecTime < recordTime)
            {
                Console.WriteLine($"Yes, he succeeded! The new world record is {totalSecTime:F2} seconds.");
            }
            else
            {
                Console.WriteLine($"No, he failed! He was {(totalSecTime - recordTime):F2} seconds slower.");
            }
        }
    }
}

 

0
Misixty avatar Misixty 0 Точки

Blagodarq :3 

0