Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- using System.Collections.Generic;
- using System.Linq;
- namespace ConsoleApp18
- {
- class Program
- {
- static void Main(string[] args)
- {
- double neededExperiance = double.Parse(Console.ReadLine());
- int countOfBattles = int.Parse(Console.ReadLine());
- double totalExperiance = 0;
- for (int i = 1; i <= countOfBattles; i++)
- {
- double experiancePerBattle = double.Parse(Console.ReadLine());
- totalExperiance += experiancePerBattle;
- if (i%3==0)
- {
- totalExperiance += experiancePerBattle * 0.15;
- }
- if (i%5==0)
- {
- totalExperiance -= experiancePerBattle * 0.1;
- }
- if (totalExperiance>=neededExperiance)
- {
- Console.WriteLine($"Player successfully collected his needed experience for {i} battles.");
- break;
- }
- }
- if (totalExperiance<neededExperiance)
- {
- Console.WriteLine($"Player was not able to collect the needed experience, {(neededExperiance-totalExperiance):f2} more needed.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement