Created
March 3, 2015 18:45
-
-
Save anonymous/9b83afbbfb77b824b268 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
long budle1 = long.Parse(Console.ReadLine()); | |
long budle2 = long.Parse(Console.ReadLine()); | |
long budle3 = long.Parse(Console.ReadLine()); | |
long budle4 = long.Parse(Console.ReadLine()); | |
long T = long.Parse(Console.ReadLine()); | |
long N = long.Parse(Console.ReadLine()); | |
long legs = (budle1*1)+(budle2*2)+(budle3*3)+(budle4*4); | |
long legsLeft = legs - (T * 4); | |
long legsPosaibleTables = legs / 4; | |
long posibleTables = Math.Abs(legsPosaibleTables - T); | |
if (legsPosaibleTables > T) | |
{ | |
posibleTables = legsPosaibleTables - posibleTables; | |
} | |
else if (T > legsPosaibleTables) | |
{ | |
posibleTables = T - posibleTables; | |
} | |
else | |
{ | |
posibleTables = T; | |
} | |
long tablesNeed = posibleTables - N; | |
long legsneed = legsPosaibleTables - N; | |
long topsneed = T - N; | |
if (tablesNeed == 0) | |
{ | |
Console.WriteLine("Just enough tables made: {0}",N); | |
} | |
else if (posibleTables > N) | |
{ | |
Console.WriteLine("more: {0} ", Math.Abs(tablesNeed)); | |
Console.WriteLine("tops left: {0}, legs left: {1}", Math.Abs(topsneed),Math.Abs(legsneed*4) ); | |
} | |
else // if (need > posibleTables) | |
{ | |
Console.WriteLine("less: {0} ", tablesNeed); | |
Console.WriteLine("tops needed: {0}, legs needed: {1}", Math.Abs(topsneed), Math.Abs(legsneed*4)); | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment