SHARE
TWEET

Beers

a guest Jun 23rd, 2015 293 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8.  
  9. class Beers
  10. {
  11.     static void Main()
  12.     {
  13.         string[] input = Console.ReadLine().Split(' ');
  14.         int beers = 0;
  15.         int stacks = 0;
  16.  
  17.         while (input[0] != "End")
  18.         {
  19.             if (input[1] == "beers")
  20.             {
  21.                 beers += Int32.Parse(input[0]);
  22.             }
  23.             else
  24.             {
  25.                 stacks += int.Parse(input[0]);
  26.             }
  27.             input = Console.ReadLine().Split(' ');
  28.         }
  29.         stacks += beers / 20;
  30.         beers %= 20;
  31.         Console.WriteLine("{0} stacks + {1} beers", stacks, beers);
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top