SHARE
TWEET

Tables

a guest Aug 27th, 2014 258 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. class Tables
  4. {
  5.     static void Main()
  6.     {
  7.         long bundle1Packets = long.Parse(Console.ReadLine());
  8.         long bundle2Packets = long.Parse(Console.ReadLine());
  9.         long bundle3Packets = long.Parse(Console.ReadLine());
  10.         long bundle4Packets = long.Parse(Console.ReadLine());
  11.         long tops = long.Parse(Console.ReadLine());
  12.         long tablesToMade = long.Parse(Console.ReadLine());
  13.  
  14.         long legs = bundle1Packets + (2 * bundle2Packets) + (3 * bundle3Packets) + (4 * bundle4Packets);
  15.         long tablesMade = tops;
  16.         long legsLeft = legs - 4 * tablesToMade;
  17.         long legsNeeded = ((tablesToMade - tablesMade) * 4) - legsLeft;
  18.         if (tablesMade > tablesToMade)
  19.         {
  20.             Console.WriteLine("more: {0}", tablesMade - tablesToMade);
  21.             Console.Write("tops left: {0}, ", tablesMade - tablesToMade);
  22.             Console.WriteLine("legs left: {0}", legsLeft);
  23.         }
  24.         else if (tablesMade < tablesToMade)
  25.         {
  26.             Console.WriteLine("less: {0}", tablesMade - tablesToMade);
  27.             Console.Write("tops needed: {0}, ", Math.Abs(tablesMade - tablesToMade));
  28.             if (legsLeft > 0)
  29.             {
  30.                 Console.WriteLine("legs needed: 0");
  31.             }
  32.             else
  33.             {
  34.                 Console.WriteLine("legs needed: {0}", legsNeeded);
  35.             }
  36.         }
  37.         else
  38.         {
  39.             Console.WriteLine("Just enough tables made: {0}", tablesMade);
  40.         }
  41.     }
  42.  
  43. }
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