Advertisement
Guest User

02. Grand Theft Examo

a guest
Oct 19th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 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 Problem2
  8. {
  9.     class Problem2
  10.     {
  11.         static void Main()
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             ulong counterSlapped = 0;
  15.             ulong counterEscaped = 0;
  16.             ulong totalSlapped = 0;
  17.             ulong sumBeers = 0;
  18.  
  19.             for (int i = 0; i < n; i++)
  20.             {
  21.                 ulong thieves = ulong.Parse(Console.ReadLine());
  22.                 ulong beers = ulong.Parse(Console.ReadLine());
  23.    
  24.  
  25.                 while (counterSlapped < 5 && thieves > 0)
  26.                 {
  27.                     counterSlapped++;
  28.                     thieves--;
  29.                 }
  30.  
  31.  
  32.                 counterEscaped += thieves;
  33.  
  34.                 sumBeers += beers;
  35.  
  36.                 totalSlapped += counterSlapped;
  37.                 counterSlapped = 0;
  38.  
  39.             }
  40.  
  41.             ulong bottleBeers = sumBeers % 6;
  42.             ulong packBeers = sumBeers / 6;
  43.  
  44.             Console.WriteLine("{0} thieves slapped.",totalSlapped);
  45.             Console.WriteLine("{0} thieves escaped.", counterEscaped);  
  46.             Console.WriteLine("{0} packs, {1} bottles.", packBeers,bottleBeers);
  47.  
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement