fbinnzhivko

02.01 Grand Theft Examo

Mar 16th, 2016
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. using System;
  2. class Problem2
  3.     {
  4.         static void Main()
  5.         {
  6.             int n = int.Parse(Console.ReadLine());
  7.             ulong counterSlapped = 0;    ulong totalSlapped = 0;
  8.             ulong sumBeers = 0;          ulong counterEscaped = 0;
  9.        
  10.         for (int i = 0; i < n; i++)
  11.             {
  12.                 ulong thieves = ulong.Parse(Console.ReadLine());
  13.                 ulong beers = ulong.Parse(Console.ReadLine());
  14.            
  15.                 while (counterSlapped < 5 && thieves > 0)
  16.                 {counterSlapped++;
  17.                 thieves--;}
  18.                
  19.                 counterEscaped += thieves;
  20.                 sumBeers += beers;
  21.                 totalSlapped += counterSlapped;
  22.  
  23.                 counterSlapped = 0;
  24.             }
  25.             Console.WriteLine("{0} thieves slapped.", totalSlapped);
  26.             Console.WriteLine("{0} thieves escaped.", counterEscaped);
  27.             Console.WriteLine("{0} packs, {1} bottles.", sumBeers / 6, sumBeers % 6);
  28.  
  29.         }
  30.     }
Add Comment
Please, Sign In to add comment