Aliendreamer

thieves80/100

Feb 18th, 2017
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 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 issue2Thieves
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int ThievesSlapped = 5;
  15.             int ThievesEscaped = 0;
  16.             int ThievesMaxSlapped = 0;
  17.             double TotalBeers = 0;
  18.             int thieves = 0;
  19.             double Beers = 0;
  20.             for (int i = 0; i < n; i++)
  21.             {
  22.                 thieves = int.Parse(Console.ReadLine());
  23.                 Beers = int.Parse(Console.ReadLine());
  24.  
  25.                 if (thieves > 5)
  26.                 {
  27.                     ThievesEscaped += thieves - ThievesSlapped;
  28.                     ThievesMaxSlapped += 5;
  29.                    TotalBeers += Beers;
  30.                 }
  31.                 else
  32.                 {
  33.                     ThievesMaxSlapped += thieves;
  34.                     TotalBeers += Beers;
  35.                 }
  36.  
  37.  
  38.  
  39.             }
  40.  
  41.             double Sixpack = Math.Floor(TotalBeers / 6);
  42.             double bottles = TotalBeers % 6;
  43.  
  44.  
  45.             Console.WriteLine("{0} thieves slapped.\n{1} thieves escaped.\n{2} packs, {3} bottles.", ThievesMaxSlapped, ThievesEscaped, Sixpack, bottles);
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.            }
  60.  
  61.         }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment