finished fordulo 2
This commit is contained in:
parent
047c4d6471
commit
f63209588d
fordulo_2
Program
.vs/Program
CopilotIndices/17.13.431.34963
FileContentIndex
copilot-chat/f9c248b7/sessions
v17
bin/Debug
obj/Debug
Sources
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": [
|
"DocumentGroups": [
|
||||||
{
|
{
|
||||||
"DockedWidth": 200,
|
"DockedWidth": 200,
|
||||||
"SelectedChildIndex": 1,
|
"SelectedChildIndex": 0,
|
||||||
"Children": [
|
"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",
|
"$type": "Document",
|
||||||
"DocumentIndex": 1,
|
"DocumentIndex": 1,
|
||||||
|
@ -30,21 +43,7 @@
|
||||||
"RelativeToolTip": "Jatekos.cs",
|
"RelativeToolTip": "Jatekos.cs",
|
||||||
"ViewState": "AgIAAAUAAAAAAAAAAAAAABAAAAAPAAAAAAAAAA==",
|
"ViewState": "AgIAAAUAAAAAAAAAAAAAABAAAAAPAAAAAAAAAA==",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
"WhenOpened": "2025-03-05T17:40:39.379Z",
|
"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": ""
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,21 @@
|
||||||
"DocumentGroups": [
|
"DocumentGroups": [
|
||||||
{
|
{
|
||||||
"DockedWidth": 200,
|
"DockedWidth": 200,
|
||||||
"SelectedChildIndex": 1,
|
"SelectedChildIndex": 0,
|
||||||
"Children": [
|
"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",
|
"$type": "Document",
|
||||||
"DocumentIndex": 1,
|
"DocumentIndex": 1,
|
||||||
|
@ -30,21 +43,7 @@
|
||||||
"RelativeToolTip": "Jatekos.cs",
|
"RelativeToolTip": "Jatekos.cs",
|
||||||
"ViewState": "AgIAAAUAAAAAAAAAAAAAABAAAAAPAAAAAAAAAA==",
|
"ViewState": "AgIAAAUAAAAAAAAAAAAAABAAAAAPAAAAAAAAAA==",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||||
"WhenOpened": "2025-03-05T17:40:39.379Z",
|
"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": ""
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Program
|
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.
25
fordulo_2/Sources/szavak.txt
Normal file
25
fordulo_2/Sources/szavak.txt
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
ADVENT
|
||||||
|
APU
|
||||||
|
LERAK
|
||||||
|
TULTESZ
|
||||||
|
KUVIK
|
||||||
|
KEZES
|
||||||
|
LETOR
|
||||||
|
LETUD
|
||||||
|
MIATT
|
||||||
|
SIET
|
||||||
|
HAZA
|
||||||
|
KICSI
|
||||||
|
BIZONY
|
||||||
|
PIRUL
|
||||||
|
CSODA
|
||||||
|
SOSEM
|
||||||
|
AMIG
|
||||||
|
KARMOL
|
||||||
|
TOVIG
|
||||||
|
TOROL
|
||||||
|
ORRUK
|
||||||
|
KUBA
|
||||||
|
KUPOS
|
||||||
|
KEFIR
|
||||||
|
FUTYUL
|
1
fordulo_2/Sources/szoveg3.txt
Normal file
1
fordulo_2/Sources/szoveg3.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
EZTKELLATIRNI
|
|
@ -35,4 +35,4 @@
|
||||||
### 3. feladat
|
### 3. feladat
|
||||||
- a: `213`
|
- a: `213`
|
||||||
- b: `KULDJPENZT`
|
- b: `KULDJPENZT`
|
||||||
- c: ``
|
- c: `APU FUTYUL ORRUK MIATT APU SIET SIET HAZA ORRUK LETOR TOVIG BIZONY LETOR`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user