Skip to content

Instantly share code, notes, and snippets.

@foliolo
Created February 22, 2017 17:18
Show Gist options
  • Save foliolo/ffdda7b83749e29226a71e5b9997a8e3 to your computer and use it in GitHub Desktop.
Save foliolo/ffdda7b83749e29226a71e5b9997a8e3 to your computer and use it in GitHub Desktop.
C# & py => Lectura de fichero para Google (Hash Code)
def readInput(fileName):
f = open(fileName, "r")
(R, C, L, H) = (int(x) for x in f.readline().split(maxsplit=4))
pizzaMat = []
i = 0
for line in f.readlines():
pizzaMat.append(tuple(line)[:-1])
i += 1
if (i >= R):
break;
return ((R, C, L, H), tuple(pizzaMat))
def mainFunction():
filename = "./Resources/input/example.in"
((R, C, L, H), pizzaMat) = readInput(filename)
print(R, C, L, H)
print (pizzaMat)
mainFunction()
namespace PizzaTest
{
class Program
{
// Variables
private static long R; //Rows
private static long C; //Columns
private static long L; //Min num of each ingredient in a slice
private static long H; //Max num of cell in a slice
private static Char[][] pizza; // Matriz bidimensional de la pizza
static void Main(string[] args)
{
foreach (string file in args)
{
RaadFile(file);
//DoWork();
//PrintResult();
}
}
private static void RaadFile(string file)
{
using (StreamReader read = new StreamReader(file))
{
string line = read.ReadLine();
string[] values = line.Split(' ');
R = long.Parse(values[0]);
C = long.Parse(values[1]);
L = long.Parse(values[2]);
H = long.Parse(values[3]);
pizza = new Char[R][C];
for(int i=0; i<R; i++)
{
pizza[i].add();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment