Programming Basics
Малко помощ,ако може.
Задачата:https://judge.softuni.bg/Contests/642/Programming-Basics-Exam-25-June-2017
Решение:
using System;
namespace Reward
{
class Reward
{
static void Main()
{
int partsProjects = int.Parse(Console.ReadLine());
double priceForPoint = double.Parse(Console.ReadLine());
double sum = 0;
double evenSum = 0;
double oddSum = 0;
double TotalPrice = 0.0;
for (int i = 1; i <= partsProjects; i++)
{
double points = double.Parse(Console.ReadLine());
if (points % 2 == 0)
{
evenSum += points * 2;
}
else
{
oddSum += points;
}
sum = evenSum + oddSum;
TotalPrice = (sum * priceForPoint);
}
Console.WriteLine($"{TotalPrice:F2}");
}
}
}
Благодаря!
Благодаря за отговора!