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