added fordulo_3 feladat_2 megoldas for a small input
This commit is contained in:
37
fordulo_3/Program/Program.cs
Normal file
37
fordulo_3/Program/Program.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Program
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Sorozat leghosszabb = new Sorozat(77031);
|
||||
leghosszabb.TagokKiszamitasa(leghosszabb.KezdoErtek);
|
||||
|
||||
int max = 110000;
|
||||
int min = 100000;
|
||||
|
||||
|
||||
for (int i = min; i < max; i++)
|
||||
{
|
||||
Sorozat sorozat = new Sorozat(i);
|
||||
sorozat.TagokKiszamitasa(sorozat.KezdoErtek);
|
||||
if (sorozat.Tagok.Count > leghosszabb.Tagok.Count)
|
||||
{
|
||||
leghosszabb = new Sorozat(sorozat);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// mivel 1.000.000 számot kell megvizsgálin ezért ez a fajta megoldás nem jó
|
||||
//Sorozat leghosszabb = sorozatok.OrderByDescending(x => x.Tagok.Count).First();
|
||||
|
||||
Console.WriteLine($"2. feladat megoldás: {leghosszabb.KezdoErtek}|{leghosszabb.Tagok.Count}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user