Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- namespace FitBoxInBox
- {
- class FitBoxInBox
- {
- static void Main()
- {
- List<int> boxOne = new List<int>();
- List<int> boxTwo = new List<int>();
- List<int> big = new List<int>();
- List<int> small = new List<int>();
- for (int i = 0; i < 3; i++)
- {
- boxOne.Add(int.Parse(Console.ReadLine()));
- }
- for (int i = 0; i < 3; i++)
- {
- boxTwo.Add(int.Parse(Console.ReadLine()));
- }
- int boxOneVol = boxOne[0] * boxOne[1] * boxOne[2];
- int boxTwoVol = boxTwo[0] * boxTwo[1] * boxTwo[2];
- if (boxOneVol > boxTwoVol)
- {
- big = boxOne.ToList();
- small = boxTwo.ToList();
- }
- else if (boxOneVol < boxTwoVol)
- {
- big = boxTwo.ToList();
- small = boxOne.ToList();
- }
- else
- {
- return;
- }
- if (big.Min() <= small.Min())
- {
- return;
- }
- else
- {
- foreach (var permu in Permutate(big, big.Count))
- {
- List<int> temp = new List<int>();
- foreach (var i in permu)
- {
- temp.Add(Convert.ToInt32(i));
- }
- if (temp[0] > small[0] && temp[1] > small[1] && temp[2] > small[2])
- {
- Console.WriteLine("(" + small[0] + ", " + small [1] + ", " + small[2] + ")" + " < " +
- "(" + permu[0] + ", " + permu[1] + ", " + permu[2] + ")");
- }
- }
- }
- }
- public static void RotateRight(IList sequence, int count)
- {
- object tmp = sequence[count - 1];
- sequence.RemoveAt(count - 1);
- sequence.Insert(0, tmp);
- }
- public static IEnumerable<IList> Permutate(IList sequence, int count)
- {
- if (count == 1) yield return sequence;
- else
- {
- for (int i = 0; i < count; i++)
- {
- foreach (var perm in Permutate(sequence, count - 1))
- yield return perm;
- if (true)
- {
- }
- RotateRight(sequence, count);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment