Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace Problem_3
- {
- class Program
- {
- static void Main(string[] args)
- {
- var heroes = new List<Hero>();
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- string character = Console.ReadLine();
- string[] charachterStats = character.Split(" ").ToArray();
- string name = charachterStats[0];
- int HP = int.Parse(charachterStats[1]);
- int MP = int.Parse(charachterStats[1]);
- heroes.Add(new Hero(name, HP, MP));
- }
- while (true)
- {
- string command = Console.ReadLine();
- if (command == "End")
- {
- break;
- }
- string[] arr = command.Split("-").ToArray();
- if (arr[0] == "CastSpell")
- {
- string name = arr[1];
- int manaCost = int.Parse(arr[2]);
- string nameSpell = arr[3];
- if (heroes.FirstOrDefault(x=>x.Name == name).MP <= manaCost)
- {
- }
- }
- }
- }
- }
- public class Hero
- {
- public Hero(string name, int hp, int mp)
- {
- this.Name = name;
- this.HP = hp;
- this.MP = mp;
- }
- public string Name { get; set; }
- public int HP { get; set; }
- public int MP { get; set; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement