Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class User_Logs
- {
- static void Main(string[] args)
- {
- string inputLine = Console.ReadLine();
- string temporarily = "";
- long health = 0;
- List<double> numbers = new List<double>();
- int count = 0;
- int countDividet = 0;
- string[] inputLineSplit = inputLine.Split(new char[] { ',' },StringSplitOptions.RemoveEmptyEntries).OrderBy(x => x).ToArray();
- foreach (var item in inputLineSplit)
- {
- // string[] test = item.Split(new char[] { }, StringSplitOptions.RemoveEmptyEntries);
- for (int i = 0; i < item.Length; i++)
- {
- char letters = item[i];
- if (letters == '-' || letters >= '0' && letters <= '9' || letters == '.')
- {
- temporarily += letters;
- }
- else if (temporarily.Length >= 1)
- {
- numbers.Add(double.Parse(temporarily));
- temporarily = "";
- }
- if (letters >= 'A' && letters <= 'Z')
- {
- health += letters;
- }
- if (letters >= 'a' && letters <= 'z')
- {
- health += letters;
- }
- if (letters == '*')
- {
- count += 2;
- }
- if (letters == '/')
- {
- countDividet += 2;
- }
- }
- double demage = 0;
- for (int i = 0; i < numbers.Count; i++)
- {
- demage += numbers[i];
- }
- if (count > 1)
- {
- demage = demage * count;
- }
- if (countDividet > 1)
- {
- demage = demage / countDividet;
- }
- Console.WriteLine("{0} - {1} health, {2:F2} damage ",item,health,demage);
- health = 0;
- demage = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement