2024-01-19 14:06:27 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics.Eventing.Reader;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace ConsoleApp1
|
|
|
|
|
{
|
|
|
|
|
class EredmenyElemzo
|
|
|
|
|
{
|
|
|
|
|
public EredmenyElemzo() { }
|
|
|
|
|
|
|
|
|
|
public bool NemVoltX(string asd)
|
|
|
|
|
{
|
|
|
|
|
return !asd.Contains('x');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
internal class Program
|
|
|
|
|
{
|
|
|
|
|
static void Toto()
|
|
|
|
|
{
|
|
|
|
|
List<(int, int, int, int, Int64, string)> list = new List<(int, int, int, int, long, string)>();
|
|
|
|
|
FileStream fs = new FileStream("toto.txt", FileMode.Open);
|
|
|
|
|
StreamReader streamReader = new StreamReader(fs);
|
|
|
|
|
|
|
|
|
|
string sor = streamReader.ReadLine();
|
|
|
|
|
string[] cim = sor.Split(';');
|
|
|
|
|
sor = streamReader.ReadLine();
|
|
|
|
|
|
|
|
|
|
while (sor != null)
|
|
|
|
|
{
|
|
|
|
|
string[] seged = sor.Split(';');
|
|
|
|
|
list.Add((int.Parse(seged[0]), int.Parse(seged[1]), int.Parse(seged[2]), int.Parse(seged[3]), Convert.ToInt64(seged[4]), seged[5]));
|
|
|
|
|
sor = streamReader.ReadLine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
streamReader.Close();
|
|
|
|
|
fs.Close();
|
|
|
|
|
|
|
|
|
|
int db = 0;
|
|
|
|
|
int telidb = 0;
|
|
|
|
|
Int64 telinyeremenyatlag = 0;
|
|
|
|
|
(Int64, int) maxnyeremeny = (0, 0);
|
|
|
|
|
(Int64, int) minnyeremeny = (Int64.MaxValue, 0);
|
|
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
telidb += item.Item4;
|
|
|
|
|
++db;
|
|
|
|
|
Int64 nyeremeny = item.Item5 * item.Item4;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (item.Item5 > maxnyeremeny.Item1)
|
|
|
|
|
{
|
|
|
|
|
maxnyeremeny.Item1 = nyeremeny;
|
|
|
|
|
maxnyeremeny.Item2 = db - 1;
|
|
|
|
|
}
|
|
|
|
|
telinyeremenyatlag += nyeremeny;
|
|
|
|
|
|
|
|
|
|
if (item.Item4 > 0 && minnyeremeny.Item1 > item.Item5)
|
|
|
|
|
{
|
|
|
|
|
minnyeremeny.Item1 = item.Item5;
|
|
|
|
|
minnyeremeny.Item2 = db - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
telinyeremenyatlag /= db;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 3.
|
|
|
|
|
Console.WriteLine($"3. feladat: Fordulók száma:{db}");
|
|
|
|
|
|
|
|
|
|
//4.
|
|
|
|
|
Console.WriteLine($"4. feladat: Telitalálatos szelvények száma:{telidb} db");
|
|
|
|
|
|
|
|
|
|
//5.
|
|
|
|
|
Console.WriteLine($"4. feladat: Átlag:{telinyeremenyatlag} Ft");
|
|
|
|
|
|
|
|
|
|
//6.
|
|
|
|
|
Console.WriteLine("6. feladat:");
|
|
|
|
|
Console.WriteLine($"\tLegnagyobb:");
|
|
|
|
|
Console.WriteLine($"\t{cim[0]}: {list[maxnyeremeny.Item2].Item1}");
|
|
|
|
|
Console.WriteLine($"\t{cim[1]}: {list[maxnyeremeny.Item2].Item2}");
|
|
|
|
|
Console.WriteLine($"\t{cim[2]}: {list[maxnyeremeny.Item2].Item3}");
|
|
|
|
|
Console.WriteLine($"\tTelitalálat: {list[maxnyeremeny.Item2].Item4}");
|
|
|
|
|
Console.WriteLine($"\tNyeremény: {list[maxnyeremeny.Item2].Item5}");
|
|
|
|
|
Console.WriteLine($"\t{cim[5]}: {list[maxnyeremeny.Item2].Item6}");
|
|
|
|
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
|
|
Console.WriteLine($"\tLegkisebb:");
|
|
|
|
|
Console.WriteLine($"\t{cim[0]}: {list[minnyeremeny.Item2].Item1}");
|
|
|
|
|
Console.WriteLine($"\t{cim[1]}: {list[minnyeremeny.Item2].Item2}");
|
|
|
|
|
Console.WriteLine($"\t{cim[2]}: {list[minnyeremeny.Item2].Item3}");
|
|
|
|
|
Console.WriteLine($"\tTelitalálat: {list[minnyeremeny.Item2].Item4}");
|
|
|
|
|
Console.WriteLine($"\tNyeremény: {list[minnyeremeny.Item2].Item5}");
|
|
|
|
|
Console.WriteLine($"\t{cim[5]}: {list[minnyeremeny.Item2].Item6}");
|
|
|
|
|
|
|
|
|
|
EredmenyElemzo er = new EredmenyElemzo();
|
|
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
|
|
|
|
if (er.NemVoltX(item.Item6))
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("8. feladat: Volt döntetlen nélküli forduló.");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
Toto();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|