Created
May 11, 2016 12:37
-
-
Save quangnle/6e42649e31842c531f32fdbb67b75ec1 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.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