Международен валутен конвертор- вярна задача в ВС, но 0/100 точки в Джъдж
Здравейте,
проверявам задачата във VS и работи коректно, но в Judge ми дава 0 точки и не разбирам от къде е проблемът. Ето задачата:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Eli_tu
{
class Program
{
static void Main(string[] args)
{
double usd = 1.79549;
double eur = 1.95583;
double gbp = 2.53405;
double convertedCurrency;
double money = double.Parse(Console.ReadLine());
string currentCurrency = Console.ReadLine();
string requiredCurrency = Console.ReadLine();
if (currentCurrency == "usd" && requiredCurrency == "bgn")
{
convertedCurrency = money * usd;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
else if (currentCurrency == "usd" && requiredCurrency == "eur")
{
convertedCurrency = money * usd / eur;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
else if (currentCurrency == "usd" && requiredCurrency == "gbp")
{
convertedCurrency = money * usd / gbp;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
if (currentCurrency == "eur" && requiredCurrency == "bgn")
{
convertedCurrency = money * eur;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
else if (currentCurrency == "eur" && requiredCurrency == "usd")
{
convertedCurrency = money * eur / usd;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
else if (currentCurrency == "eur" && requiredCurrency == "gbp")
{
convertedCurrency = money * eur / gbp;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
if (currentCurrency == "gbp" && requiredCurrency == "bgn")
{
convertedCurrency = money * gbp;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
else if (currentCurrency == "gbp" && requiredCurrency == "eur")
{
convertedCurrency = money * gbp / eur;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
else if (currentCurrency == "gbp" && requiredCurrency == "usd")
{
convertedCurrency = money * gbp / usd;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
if (currentCurrency == "bgn" && requiredCurrency == "usd")
{
convertedCurrency = money / usd;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
else if (currentCurrency == "bgn" && requiredCurrency == "eur")
{
convertedCurrency = money / eur;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
else if (currentCurrency == "bgn" && requiredCurrency == "gbp")
{
convertedCurrency = money / gbp;
Console.WriteLine(Math.Round(convertedCurrency, 2));
}
}
}
}
Благодаря за отговора това го оправих, но отново нищо. Опитах и по други начини, които отново са верни на компилатора, но при Judge съм на 0. Ето още едно решение, но не се получава:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Eli_tu
{
class Program
{
static void Main(string[] args)
{
double usdCourse = 1.79549;
double eurCourse = 1.95583;
double gbpCourse = 2.53405;
double money = double.Parse(Console.ReadLine());
string currentCurrency = Console.ReadLine();
string requiredCurrency = Console.ReadLine();
if (currentCurrency == "usd")
{
if (requiredCurrency == "bgn")
{
Console.WriteLine(Math.Round(money * usdCourse, 2) + " BGN");
}
else if (requiredCurrency=="eur")
{
Console.WriteLine(Math.Round(money*usdCourse/eurCourse, 2) + " EUR");
}
else if (requiredCurrency=="gbp")
{
Console.WriteLine(Math.Round(money*usdCourse/gbpCourse, 2)+ " GBP");
}
}
else if (currentCurrency == "eur")
{
if (requiredCurrency== "bgn")
{
Console.WriteLine(Math.Round(money*eurCourse, 2) +" BGN");
}
else if(requiredCurrency== "usd")
{
Console.WriteLine(Math.Round(money*eurCourse/usdCourse, 2) + " USD");
}
else if (requiredCurrency== "gbp")
{
Console.WriteLine(Math.Round(money*eurCourse/gbpCourse, 2) +" GBP");
}
}
else if (currentCurrency== "gbp")
{
if (requiredCurrency=="bgn")
{
Console.WriteLine(Math.Round(money*gbpCourse, 2) + " BGN");
}
else if (requiredCurrency == "usd")
{
Console.WriteLine(Math.Round(money * gbpCourse / usdCourse, 2) + " USD");
}
else if (requiredCurrency== "eur")
{
Console.WriteLine(Math.Round(money*gbpCourse/eurCourse, 2) + " EUR");
}
}
else if (currentCurrency == "bgn")
{
if (requiredCurrency == "usd")
{
Console.WriteLine(Math.Round(money/usdCourse, 2) +" USD");
}
else if (requiredCurrency== "eur")
{
Console.WriteLine(Math.Round(money/eurCourse, 2) + " EUR");
}
else if (requiredCurrency== "gbp")
{
Console.WriteLine(Math.Round(money/gbpCourse, 2) + " GBP");
}
}
}
}
}