Feladatok és megoldásaik hozzáadása

This commit is contained in:
Digi 2025-02-26 19:43:54 +01:00
commit 2d3a3b5498
31 changed files with 1765 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,188 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
public static class Karakterek
{
public static List<char> KarakterekList = new List<char>();
public static void ReadDataFromFile(string path)
{
KarakterekList = File.ReadAllText(path).ToCharArray().ToList();
}
public static List<char> LongestStringWithTwoCharactersOnly()
{
if (KarakterekList.Count < 2)
return new List<char>();
List<char> currentBestCharacterSequence = new List<char>();
List<char> currentCharacterSequence = new List<char>();
char firstChar = KarakterekList[0];
char secondChar = KarakterekList[1];
currentCharacterSequence.Add(firstChar);
currentCharacterSequence.Add(secondChar);
for (int i = 2; i < KarakterekList.Count; i++)
{
char item = KarakterekList[i];
if (item == firstChar || item == secondChar)
{
currentCharacterSequence.Add(item);
}
else
{
if (currentCharacterSequence.Count > currentBestCharacterSequence.Count)
{
currentBestCharacterSequence = new List<char>(currentCharacterSequence);
}
firstChar = currentCharacterSequence[currentCharacterSequence.Count - 1];
secondChar = item;
currentCharacterSequence.Clear();
currentCharacterSequence.Add(firstChar);
currentCharacterSequence.Add(secondChar);
}
}
if (currentCharacterSequence.Count > currentBestCharacterSequence.Count)
{
currentBestCharacterSequence = currentCharacterSequence;
}
return currentBestCharacterSequence;
}
public static int CountABCSequences(string input)
{
int count = 0;
for (int i = 0; i < input.Length; i++)
{
if (input[i] == 'a')
{
for (int j = i + 1; j < input.Length; j++)
{
if (input[j] == 'b')
{
for (int k = j + 1; k < input.Length; k++)
{
if (input[k] == 'c')
{
count++;
}
}
}
}
}
}
return count;
}
public static int TotalDistanceTraveled(string input){
int x = 0;
int y = 0;
for (int i = 0; i < input.Length; i++)
{
if (input[i] == 'b')
{
x++;
}
else if (input[i] == 'd')
{
x--;
}
else if (input[i] == 'a')
{
y++;
}
else if (input[i] == 'c')
{
y--;
}
}
return (int)Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
}
}
public static class Szoveg{
public static List<string> fullTextInListOfString = new List<string>();
public static List<string> wordsWithUniqeCharactersOnly = new List<string>();
public static void ReadDataFromFile(string path)
{
var lines = File.ReadAllText(path).Split(new string[] { Environment.NewLine }, StringSplitOptions.None).ToList();
foreach (var line in lines)
{
var allStringsInLine = line.Split(' ');
foreach (var str in allStringsInLine)
{
fullTextInListOfString.Add(str);
}
}
}
public static List<string> WordsWithUniqeCharactersOnly()
{
foreach (var word in fullTextInListOfString)
{
if (word.Distinct().Count() == word.Length)
{
wordsWithUniqeCharactersOnly.Add(word);
}
}
return wordsWithUniqeCharactersOnly;
}
public static string LongestStringWithUniqueCharacters()
{
return wordsWithUniqeCharactersOnly.OrderByDescending(s => s.Length).First();
}
}
public class Program
{
public static void Main(string[] args)
{
Karakterek.ReadDataFromFile(@"..\karsor.txt");
//System.Console.WriteLine($"{Karakterek.KarakterekList.Count}");
// feladat 1 a
/*
var longestStringWithTwoCharactersOnly = Karakterek.LongestStringWithTwoCharactersOnly();
var karakterek = longestStringWithTwoCharactersOnly.Distinct().OrderBy(c => c).ToArray();
int longestStringWithTwoCharactersOnlyLength = longestStringWithTwoCharactersOnly.Count;
System.Console.WriteLine($"{karakterek[0]}{karakterek[1]}{longestStringWithTwoCharactersOnlyLength}");
*/
// feladat 1 b
// ez az input változó volt használva a b és a c részben is
//string input = new string(Karakterek.KarakterekList.ToArray());
//System.Console.WriteLine($"{Karakterek.CountABCSequences(input)}");
// feladat 1 c
//System.Console.WriteLine($"{Karakterek.TotalDistanceTraveled(input)}");
// feladat 2 a
Szoveg.ReadDataFromFile(@"..\szoveg.txt");
Szoveg.wordsWithUniqeCharactersOnly = Szoveg.WordsWithUniqeCharactersOnly();
System.Console.WriteLine($"{Szoveg.LongestStringWithUniqueCharacters()}");
}
}

View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v9.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v9.0": {
"Program/1.0.0": {
"runtime": {
"Program.dll": {}
}
}
}
},
"libraries": {
"Program/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net9.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "9.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]

View File

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Program")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Program")]
[assembly: System.Reflection.AssemblyTitleAttribute("Program")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -0,0 +1 @@
17a31eb238f6f175e91f757bce7478ca3439291fdf71caa540b0d35a4a757b14

View File

@ -0,0 +1,15 @@
is_global = true
build_property.TargetFramework = net9.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Program
build_property.ProjectDir = E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 9.0
build_property.EnableCodeStyleSeverity =

View File

@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@ -0,0 +1 @@
994355595e6d8516655760be3cd67da1c71aa921f3caa99233e6f9c4eb253af7

View File

@ -0,0 +1,14 @@
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\bin\Debug\net9.0\Program.exe
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\bin\Debug\net9.0\Program.deps.json
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\bin\Debug\net9.0\Program.runtimeconfig.json
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\bin\Debug\net9.0\Program.dll
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\bin\Debug\net9.0\Program.pdb
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\obj\Debug\net9.0\Program.GeneratedMSBuildEditorConfig.editorconfig
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\obj\Debug\net9.0\Program.AssemblyInfoInputs.cache
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\obj\Debug\net9.0\Program.AssemblyInfo.cs
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\obj\Debug\net9.0\Program.csproj.CoreCompileInputs.cache
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\obj\Debug\net9.0\Program.dll
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\obj\Debug\net9.0\refint\Program.dll
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\obj\Debug\net9.0\Program.pdb
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\obj\Debug\net9.0\Program.genruntimeconfig.cache
E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\obj\Debug\net9.0\ref\Program.dll

Binary file not shown.

View File

@ -0,0 +1 @@
ec5aef107619cf514071397c5ff593bd138d87eb40c2063670b11375de2d8f47

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,73 @@
{
"format": 1,
"restore": {
"E:\\Házi\\13.osztály\\Neumann_Verseny\\fordulo_1\\Program\\Program.csproj": {}
},
"projects": {
"E:\\Házi\\13.osztály\\Neumann_Verseny\\fordulo_1\\Program\\Program.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "E:\\Házi\\13.osztály\\Neumann_Verseny\\fordulo_1\\Program\\Program.csproj",
"projectName": "Program",
"projectPath": "E:\\Házi\\13.osztály\\Neumann_Verseny\\fordulo_1\\Program\\Program.csproj",
"packagesPath": "C:\\Users\\Marci\\.nuget\\packages\\",
"outputPath": "E:\\Házi\\13.osztály\\Neumann_Verseny\\fordulo_1\\Program\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\Marci\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net9.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.200"
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.200/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Marci\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.13.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Marci\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -0,0 +1,79 @@
{
"version": 3,
"targets": {
"net9.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net9.0": []
},
"packageFolders": {
"C:\\Users\\Marci\\.nuget\\packages\\": {},
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "E:\\Házi\\13.osztály\\Neumann_Verseny\\fordulo_1\\Program\\Program.csproj",
"projectName": "Program",
"projectPath": "E:\\Házi\\13.osztály\\Neumann_Verseny\\fordulo_1\\Program\\Program.csproj",
"packagesPath": "C:\\Users\\Marci\\.nuget\\packages\\",
"outputPath": "E:\\Házi\\13.osztály\\Neumann_Verseny\\fordulo_1\\Program\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\Marci\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net9.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.200"
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.200/PortableRuntimeIdentifierGraph.json"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "ETkpdKREBtU=",
"success": true,
"projectFilePath": "E:\\Házi\\13.osztály\\Neumann_Verseny\\fordulo_1\\Program\\Program.csproj",
"expectedPackageFiles": [],
"logs": []
}

1
fordulo_1/karsor.txt Normal file
View File

@ -0,0 +1 @@
adcbcabdddabdbbaabbcdabdcdcbaccbcdbaccbbbaabdabccaddbddcbdabbbbddbaabccdbdbadaabbdaadaddbdccbccbadbacdccbddccbbbbbbacdddbaaccbdbaaddcdbccacaddacbdbcbbcddabdabcbaacaaaacdbbadbadcaabdbcbbdbddadadcabbdabaabbcadaddaddddbbcbbbbcbbabcdbbcddbdacaccbababbacabbdbbdbddabdabaadbabbdbbdabbcabacccaadcbccaabbacbcbbbadbaaacdddaaacaacbbbdababadabcaacbcdaabcccadacabcdbabcdcacdbbbdbabcccddbaaccdbcbabdcbdacacbdaaddcabacbcbddcbbdbddacbdcacbdabaaccbddcadcbaccbadcbbacdadbdbabdccdcabacbaabbacabbcaccacbaccbbddbbcbadadbcccaaaaacddccccdcddabbbccdcaccbdcabdcbdbcbadabcadddcdbacdbdccaacbabdaccdacbbcbcacbbbdcbddcaddddacbadbbadccaddaaabccaadbbddcdcbacbdcacadacbacdaadacaaaacadbbadddbbaabbbbdbbadbabbcccabadbacbdddacbadbaccddabaacdabbdcdbdbcccadabacdadacbcbcccacbcacddadbabddccbbbbbcddbbdcbbdbdbdcdcadadbddcacbdcbddccabbbdbdbbddaddbcdbaacaddbdadddabdaacdabcadddbadcacbbbabcbaabaabcacbdbcbbaddabcdadadbddbacbacdbcccaaacbcbdaaabdaccbbcacdbadaddcccddbcdaddadddcaddabcbbdcdabdaaabddbbdbabdacdccbbcaddbcbbbdadbddddaacdbcabdadabcc

1239
fordulo_1/szoveg.txt Normal file

File diff suppressed because it is too large Load Diff

30
fordulo_1/terkep.txt Normal file
View File

@ -0,0 +1,30 @@
9 7 2 5 10 11 19 9 7 15 19 2 16 12 9 13 3 13 10 14 4 11 7 11 7 7 17 10 9 8
13 10 18 9 11 15 18 20 12 9 12 1 10 10 6 10 14 15 15 6 2 12 9 6 8 4 12 7 7 2
16 13 18 10 11 3 4 11 5 13 18 7 10 9 5 5 20 17 13 7 12 5 3 7 4 18 2 8 2 15
1 20 8 3 9 7 21 20 6 16 19 19 11 11 12 13 16 2 1 20 13 5 6 5 11 10 12 7 10 13
3 1 9 9 13 6 18 10 13 2 14 2 10 19 7 10 6 14 5 11 6 13 14 2 5 15 6 20 6 4
6 9 9 17 20 15 7 3 15 18 13 8 12 15 1 8 2 11 8 7 12 13 12 18 14 10 5 15 18 11
11 4 14 13 12 10 19 12 17 7 10 2 13 18 9 19 13 9 1 10 20 3 11 4 17 15 9 18 18 9
20 15 12 7 14 6 7 3 7 3 8 1 19 10 14 6 1 4 17 1 14 11 14 2 2 15 15 9 17 2
4 17 13 6 2 19 13 20 11 15 19 14 11 2 1 16 16 17 5 18 3 8 3 13 14 20 2 4 13 8
3 17 8 1 16 12 13 6 5 18 3 2 7 19 14 18 15 10 17 6 2 6 21 3 5 4 7 18 19 7
16 7 20 7 7 21 5 19 11 7 13 18 16 4 20 19 19 17 5 5 12 13 9 7 11 11 20 13 1 15
7 6 20 2 11 13 17 14 2 4 19 16 9 14 14 15 6 1 15 13 19 17 8 8 18 4 7 16 17 14
5 8 20 10 9 10 11 11 8 3 3 1 14 17 13 10 3 5 15 4 16 15 10 8 18 16 3 20 9 18
7 17 3 20 6 3 20 1 2 10 15 19 20 17 3 5 4 2 18 13 4 20 9 12 11 17 9 8 18 18
1 14 14 11 16 4 15 9 10 15 3 14 7 3 19 11 18 17 18 9 9 10 13 3 7 9 8 2 6 14
14 10 6 21 13 20 13 12 6 14 7 9 10 6 4 16 1 16 7 19 8 14 9 2 3 7 15 12 12 3
17 10 10 3 5 7 4 16 7 5 17 19 12 17 5 1 10 17 20 5 11 14 19 8 13 10 2 7 7 18
18 16 3 2 7 5 15 6 6 4 6 6 18 12 20 4 15 12 17 3 13 1 9 19 15 19 12 19 13 4
11 15 13 14 2 5 7 8 20 4 19 11 8 21 10 2 12 7 20 12 9 11 11 6 11 5 13 18 5 16
11 2 6 18 12 3 15 16 8 12 17 8 2 5 19 7 2 11 9 13 18 13 20 13 2 11 14 4 5 17
16 6 11 7 4 13 7 13 1 3 3 7 11 9 12 5 20 7 7 14 20 6 15 2 5 7 1 9 19 11
10 9 19 15 8 6 17 9 7 8 13 17 14 10 3 19 10 11 1 4 7 20 20 1 15 1 12 14 7 14
5 15 10 15 12 18 14 20 20 2 18 10 12 14 17 2 12 19 14 13 19 8 13 1 19 18 13 19 3 5
5 6 11 17 12 13 14 17 10 4 11 11 9 20 15 1 10 9 12 8 4 10 19 16 3 3 5 20 8 2
2 15 17 16 19 19 1 3 10 1 9 3 21 1 7 3 17 2 7 21 6 13 6 6 9 13 6 11 17 20
13 15 8 15 8 6 12 16 4 9 6 20 20 11 12 13 20 18 5 17 1 9 7 7 12 20 19 14 15 1
12 19 19 4 16 1 17 5 11 5 8 11 13 8 4 15 12 5 12 19 15 13 3 6 10 12 20 13 20 3
10 9 4 5 16 11 17 13 7 7 13 14 6 8 15 5 6 19 17 18 6 18 2 15 4 14 10 14 16 11
9 9 19 17 1 9 6 8 4 18 6 14 3 9 5 5 15 2 5 13 1 9 8 7 20 6 11 9 16 6
7 14 6 8 13 15 11 19 19 5 18 12 2 2 19 5 2 9 3 19 5 11 13 1 3 7 10 6 6 17

18
megoldasok.md Normal file
View File

@ -0,0 +1,18 @@
# Megoldások
## 1. Forduló
### 1. feladat
- a: `cd11`
- b: `2485669`
- c: `37`
### 2. feladat
- a: `MEGFORDULTAK`
- b: ``
- c: ``
### 3. feladat
- a: `7`
- b: ``
- c: ``