Google-Searches MidRetake
You will be given several lines of input and you must calculate how much money Google makes from user searchi On the first line, you will receive the Google income from a single search of a user. On the second line you will receive the number of users . On the following n lines, you will get the number of searches each user make. You must calculate the total money from the searches. However, there are some additional rules: If the searches of a user are more than 5, we double the money earned from the searches. If a user makes just one search, we ignore the search and Google did not earn any money from it For each third user, the money per search is tripled O If third user's searches are greater than 5, you should ALSO double the money per search DI Ifthird user make one search, the search should be ignored. After calculating the total money, print them in the following format: "Total money earned: {totalMoney)". The money should be formatted to the second decimal point. Input First line: money per search - floating-point number in range [0.00 - 5000.001. Second line: number of users - integer in range [0 - 10000]. Next lines: number of searches for each user- integer in range [0 - 10000]. Output Print the output in the format described above. Constraints The command will always be valid.
using System;
namespace _01.FirstExercise
{
internal class Program
{
static void Main(string[] args)
{
double moneyPerSearch = double.Parse(Console.ReadLine());
int numberOfUsers = int.Parse(Console.ReadLine());
double totalMoney = 0;
for (int user = 1; user <= numberOfUsers; user++)
{
int currentUser = int.Parse(Console.ReadLine());
if (currentUser == 1 || currentUser <= 0) continue;
if (!(user % 3 == 0) && (currentUser > 1 && currentUser <= 5))
{
totalMoney += moneyPerSearch * currentUser;
}
if (currentUser > 5)
{
double moneyEarned = moneyPerSearch * (double)currentUser * 2;
totalMoney += moneyEarned;
}
if (user % 3 == 0)
{
if (currentUser == 1 || currentUser <= 0) continue;
double tripled = moneyPerSearch * 3;
if (currentUser > 1 && currentUser <= 5)
{
tripled *= currentUser;
totalMoney += tripled;
}
if (currentUser > 5)
{
double @doubeOparation = moneyPerSearch * 2 * numberOfUsers;
totalMoney += doubeOparation;
}
}
}
Console.WriteLine($"Total money earned: {totalMoney:f2}");
}
}
}
Моля за решение! Благодаря предварително!
Не, открих грешката. Благодаря Ви за помоща!
А ти какви точки вземаш с това решение?В системата(Judje) няма задача с такова име.