Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp12
- {
- class Program
- {
- static void Main(string[] args)
- {
- double expNeeded = double.Parse(Console.ReadLine());
- int countBattles = int.Parse(Console.ReadLine());
- double currentExp = 0;
- for(int i=1; i<=countBattles; i++)
- {
- double expPerBattle = double.Parse(Console.ReadLine());
- bool isThird = false, isFifth = false;
- if (i % 3 == 0) isThird = true;
- if (i % 5 == 0) isFifth = true;
- if (isThird && isFifth) currentExp += expPerBattle * 1.05; // samo 5% bonus
- else if (isThird) currentExp += expPerBattle * 1.15; // bonus 15%
- else if (isFifth) currentExp += expPerBattle * 0.90; // minus 10%
- else currentExp += expPerBattle;
- if (currentExp >= expNeeded)
- {
- Console.WriteLine($"Player successfully collected his needed experience for {i} battles.");
- break;
- }
- }
- if(expNeeded > currentExp) Console.WriteLine($"Player was not able to collect the needed experience, {(expNeeded - currentExp):F2} more needed.");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment