Skip to content

Instantly share code, notes, and snippets.

@quangnle
Created May 11, 2016 12:37
Show Gist options
  • Save quangnle/6e42649e31842c531f32fdbb67b75ec1 to your computer and use it in GitHub Desktop.
Save quangnle/6e42649e31842c531f32fdbb67b75ec1 to your computer and use it in GitHub Desktop.
using System;
using System.IO;
namespace Tuenti1
{
class Program
{
static void Main(string[] args)
{
var lines = File.ReadAllLines("submitInput.txt");
var nTestCases = Convert.ToInt32(lines[0]);
var result = "";
for (int i = 1; i <= nTestCases; i++)
{
var nPersons = Convert.ToInt32(lines[i]);
int nTables = 0;
if (nPersons >= 1 && nPersons <= 4)
nTables = 1;
else if (nPersons > 4)
nTables = ((nPersons - 4) >> 1) + (nPersons & 1) + 1;
result += string.Format("Case #{0}: {1}\n",i, nTables);
}
string path = "submitOutput.txt";
File.WriteAllText(path, result.ToString());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment