BubaLazi

Exam1-HornetAssult-proba

Aug 15th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace PreparingForExams
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             List<int> beehives = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  14.             List<int> hornets = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  15.             int sum = 0;
  16.             List<int> aliveBees = new List<int>();
  17.  
  18.             for(int i = 0; i< hornets.Count; i++)
  19.             {
  20.                 sum += hornets[i];
  21.             }
  22.  
  23.             for(int i =0; i < beehives.Count;i++)
  24.             {
  25.                 if (sum > beehives[i])
  26.                 {
  27.                     beehives.Remove(beehives[i]);
  28.                     Console.WriteLine(string.Join(" ", beehives));
  29.                 }
  30.  
  31.                 if (sum < beehives[i])
  32.                 {
  33.                     aliveBees[i] = beehives[i] - sum;
  34.                     sum = sum - hornets[0];
  35.                     hornets.Remove(0);
  36.                     Console.WriteLine(sum);
  37.                     Console.WriteLine(string.Join(" ", aliveBees));
  38.                 }
  39.             }
  40.             //Console.WriteLine(sum);
  41.             //Console.WriteLine(string.Join(" ", aliveBees));
  42.  
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment