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;
- using System.Numerics;
- namespace VII_02_Exam
- {
- class Program
- {
- static void Main(string[] args)
- {
- SortedDictionary<double, string> reinbowdrops = new SortedDictionary<double, string>();
- while (true)
- {
- string command = Console.ReadLine();
- if (command == "End") break;
- var tmp = command.Split(new char[] { ' ' },StringSplitOptions.RemoveEmptyEntries);
- if (tmp.Length == 4)
- {
- double volume = double.Parse(tmp[0]);
- int R = int.Parse(tmp[1]);
- int G = int.Parse(tmp[2]);
- int B = int.Parse(tmp[3]);
- if (R > 255 || R < 0) R = 0;
- if (G > 255 || G < 0) G = 0;
- if (B > 255 || B < 0) B = 0;
- if ((R < 100 && G < 100 && B > 200) || (R < 100 && G > 200 && B < 100) || (R > 200 && G < 100 && B < 100))
- {
- reinbowdrops.Add(volume, $" V:{volume:F2} -> R:{R} G:{G} B:{B}");
- }
- }
- }
- int index = 1;
- Console.WriteLine($"Rainbow Raindrops: {reinbowdrops.Count}");
- foreach (var drop in reinbowdrops)
- {
- Console.WriteLine($"{index}.{drop.Value}");
- index++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement