finished fordulo 2
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -18,8 +18,21 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 1,
|
||||
"SelectedChildIndex": 0,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Program.cs",
|
||||
"RelativeDocumentMoniker": "Program.cs",
|
||||
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Program.cs",
|
||||
"RelativeToolTip": "Program.cs",
|
||||
"ViewState": "AgIAAKIAAAAAAAAAAAAuwMYAAAAqAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-05T11:40:10.358Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
@@ -30,21 +43,7 @@
|
||||
"RelativeToolTip": "Jatekos.cs",
|
||||
"ViewState": "AgIAAAUAAAAAAAAAAAAAABAAAAAPAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-05T17:40:39.379Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Program.cs",
|
||||
"RelativeDocumentMoniker": "Program.cs",
|
||||
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Program.cs",
|
||||
"RelativeToolTip": "Program.cs",
|
||||
"ViewState": "AgIAAFAAAAAAAAAAAAAuwH4AAAANAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-05T11:40:10.358Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2025-03-05T17:40:39.379Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -18,8 +18,21 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 1,
|
||||
"SelectedChildIndex": 0,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Program.cs",
|
||||
"RelativeDocumentMoniker": "Program.cs",
|
||||
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Program.cs",
|
||||
"RelativeToolTip": "Program.cs",
|
||||
"ViewState": "AgIAAKIAAAAAAAAAAAAuwMYAAAAqAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-05T11:40:10.358Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
@@ -30,21 +43,7 @@
|
||||
"RelativeToolTip": "Jatekos.cs",
|
||||
"ViewState": "AgIAAAUAAAAAAAAAAAAAABAAAAAPAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-05T17:40:39.379Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Program.cs",
|
||||
"RelativeDocumentMoniker": "Program.cs",
|
||||
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Program.cs",
|
||||
"RelativeToolTip": "Program.cs",
|
||||
"ViewState": "AgIAAFAAAAAAAAAAAAAuwH4AAAAMAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-03-05T11:40:10.358Z",
|
||||
"EditorCaption": ""
|
||||
"WhenOpened": "2025-03-05T17:40:39.379Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Program
|
||||
@@ -123,9 +124,98 @@ namespace Program
|
||||
|
||||
}
|
||||
|
||||
Console.WriteLine(new string(solvedCharsForFeladatB.ToArray()));
|
||||
|
||||
Console.WriteLine($"B feladat megoldás: {new string(solvedCharsForFeladatB.ToArray())}");
|
||||
|
||||
|
||||
// c feladat
|
||||
string atirando = "EZTKELLATIRNI";
|
||||
string pathToSzavak = @"..\..\..\Sources\szavak.txt";
|
||||
|
||||
var szavak = File.ReadAllLines(pathToSzavak);
|
||||
|
||||
Dictionary<int, char> reversedLookUpTable = new Dictionary<int, char>();
|
||||
reversedLookUpTable.Add(0, 'A');
|
||||
reversedLookUpTable.Add(1, 'E');
|
||||
reversedLookUpTable.Add(2, 'I');
|
||||
reversedLookUpTable.Add(3, 'O');
|
||||
reversedLookUpTable.Add(4, 'U');
|
||||
|
||||
List<char> titkositottKarakterek = new List<char>();
|
||||
|
||||
foreach (char c in atirando)
|
||||
{
|
||||
for (int row = 0; row < tablazat.GetLength(0); row++)
|
||||
{
|
||||
for (int col = 0; col < tablazat.GetLength(1); col++)
|
||||
{
|
||||
if (tablazat[row, col] == c)
|
||||
{
|
||||
titkositottKarakterek.Add(reversedLookUpTable[row]);
|
||||
titkositottKarakterek.Add(reversedLookUpTable[col]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string feladatCString = new string(titkositottKarakterek.ToArray());
|
||||
Console.WriteLine(feladatCString);
|
||||
|
||||
foreach (var item in szavak)
|
||||
{
|
||||
Console.WriteLine(item);
|
||||
}
|
||||
|
||||
List<string> feladatCMegoldas = new List<string>();
|
||||
|
||||
for (int i = 0; i < feladatCString.Length; i+=2)
|
||||
{
|
||||
char firstChar = feladatCString[i];
|
||||
char secondChar = feladatCString[i + 1];
|
||||
|
||||
string pattern;
|
||||
if (firstChar == secondChar)
|
||||
{
|
||||
pattern = $@"^(?=.*{firstChar}.*{firstChar}).*{firstChar}.*{firstChar}.*$";
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern = $@"^(?!.*{firstChar}.*{firstChar})(?!.*{secondChar}.*{secondChar}).*{firstChar}.*{secondChar}.*$";
|
||||
}
|
||||
Regex regex = new Regex(pattern);
|
||||
|
||||
foreach (string szo in szavak)
|
||||
{
|
||||
if (regex.IsMatch(szo))
|
||||
{
|
||||
feladatCMegoldas.Add(szo);
|
||||
//Console.WriteLine($"{firstChar} - {secondChar} - {szo}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in feladatCMegoldas)
|
||||
{
|
||||
Console.Write(item + " ");
|
||||
}
|
||||
Console.WriteLine();
|
||||
|
||||
//Ellenőrzés a kapott kódra
|
||||
/*
|
||||
|
||||
List<char> solvedCharsForFeladatC = new List<char>();
|
||||
for (int i = 0; i < feladatCString.Length; i += 2)
|
||||
{
|
||||
int row = lookUpTable[feladatCString[i]];
|
||||
int col = lookUpTable[feladatCString[i + 1]];
|
||||
|
||||
solvedCharsForFeladatC.Add(tablazat[row, col]);
|
||||
|
||||
}
|
||||
|
||||
Console.WriteLine( new string(solvedCharsForFeladatC.ToArray()));
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user