solved fordulo_2 feladat_1

This commit is contained in:
Digi 2025-03-05 14:41:25 +01:00
parent dc971298b8
commit d07b86a0a1
42 changed files with 510 additions and 3 deletions

View File

@ -13,7 +13,7 @@ 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+4370f4cd05125a6cf533b209e139477f99b353dd")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+dc971298b8cb50b3964136e51880e4b38a03bd9f")]
[assembly: System.Reflection.AssemblyProductAttribute("Program")]
[assembly: System.Reflection.AssemblyTitleAttribute("Program")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
73ebb59b91d6ddf6e8dd33d5b30abd9efdedbeb154e4bd540e805b4ea0fe83ff
1f36a25f79f6a9f6f095f37aae6480c14a96c8f4edc9dee92182a5a1fce682b7

View File

@ -8,7 +8,7 @@ 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.ProjectDir = E:\Házi\13.osztály\Neumann_Verseny\fordulo_1\Program\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 9.0

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,54 @@
{
"Version": 1,
"WorkspaceRootPath": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|e:\\h\u00E1zi\\13.oszt\u00E1ly\\neumann_verseny\\fordulo_2\\program\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|e:\\h\u00E1zi\\13.oszt\u00E1ly\\neumann_verseny\\fordulo_2\\program\\idopont.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|solutionrelative:idopont.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Idopont.cs",
"DocumentMoniker": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Idopont.cs",
"RelativeDocumentMoniker": "Idopont.cs",
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Idopont.cs",
"RelativeToolTip": "Idopont.cs",
"ViewState": "AgIAAAIAAAAAAAAAAAAAwC4AAAAJAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-03-05T11:46:26.985Z",
"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": "AgIAAAsAAAAAAAAAAAAIwDcAAAAoAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-03-05T11:40:10.358Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@ -0,0 +1,54 @@
{
"Version": 1,
"WorkspaceRootPath": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|e:\\h\u00E1zi\\13.oszt\u00E1ly\\neumann_verseny\\fordulo_2\\program\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|solutionrelative:program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|e:\\h\u00E1zi\\13.oszt\u00E1ly\\neumann_verseny\\fordulo_2\\program\\idopont.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}|Program.csproj|solutionrelative:idopont.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Idopont.cs",
"DocumentMoniker": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Idopont.cs",
"RelativeDocumentMoniker": "Idopont.cs",
"ToolTip": "E:\\H\u00E1zi\\13.oszt\u00E1ly\\Neumann_Verseny\\fordulo_2\\Program\\Idopont.cs",
"RelativeToolTip": "Idopont.cs",
"ViewState": "AgIAAAIAAAAAAAAAAAAAwC4AAAAJAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-03-05T11:46:26.985Z",
"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": "AgIAABIAAAAAAAAAAAA4wDUAAAANAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-03-05T11:40:10.358Z",
"EditorCaption": ""
}
]
}
]
}
]
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

View File

@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Program
{
class Idopont
{
public int Ora { get; set; }
public int Perc { get; set; }
public string Name { get; set; }
public Double Angle { get; set; }
public Idopont(int ora, int perc)
{
Ora = ora;
Perc = perc;
Name = ReturnFormattedTime();
if (Ora >= 12)
{
Ora -= 12;
}
}
public string ReturnFormattedTime()
{
return string.Format("{0}:{1}", Ora, Perc);
}
public double ClockAngle()
{
double angle = 0;
angle = Math.Abs(Ora * 30 + Perc * 0.5 - Perc * 6);
if (angle > 180)
{
angle = 360 - angle;
}
Angle = angle;
return angle;
}
}
}

View File

@ -0,0 +1,151 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Program
{
class Program
{
static void Main(string[] args)
{
//Feladat1();
Feladat2();
}
static void Feladat2()
{
string path = @"..\..\..\Sources\dobasok.txt";
string path2 = @"..\..\..\Sources\dontesek.txt";
var dobasok = new List<int>();
var dontesek = new List<int>();
//dobasok
var data = File.ReadAllText(path).Trim();
string splitable = "";
foreach (char c in data)
{
splitable += " " + c.ToString();
}
var dobasokData = splitable.Trim().Split(' ');
foreach (var item in dobasokData)
{
dobasok.Add(Convert.ToInt32(item));
}
//dontesek
var data2 = File.ReadAllText(path2).Trim();
string splitable2 = "";
foreach (char c in data2)
{
splitable2 += " " + c.ToString();
}
var dontesekData = splitable2.Trim().Split(' ');
foreach (var item in dontesekData)
{
dontesek.Add(Convert.ToInt32(item));
}
}
static void Feladat1()
{
string path = @"..\..\..\Sources\idopontok.txt";
var idopontok = new List<Idopont>();
var data = File.ReadAllLines(path);
foreach (var line in data)
{
var parts = line.Split(' ');
Idopont idopont = new Idopont(int.Parse(parts[0]), int.Parse(parts[1]));
idopontok.Add(idopont);
}
foreach (var idopont in idopontok)
{
Console.WriteLine($"{idopont.Name}, {idopont.ClockAngle()}°");
}
Console.WriteLine($"Legnagyobb szögű időpont: {idopontok.OrderByDescending(x => x.Angle).First().Name}");
// nem biztos, hogy jó
List<double> angleDifferences = new List<double>();
for (int i = 0; i < idopontok.Count - 1; i++)
{
angleDifferences.Add(Math.Abs(idopontok[i].Angle - idopontok[i + 1].Angle));
}
Console.WriteLine($"Legkisebb változás: {angleDifferences.Min()}°");
var idopontok2 = new List<Idopont>();
int napok = 5;
for (int i = 0; i < napok; i++)
{
for (int orak = 0; orak < 24; orak++)
{
for (int percek = 0; percek < 60; percek++)
{
Idopont idopont = new Idopont(orak, percek);
idopont.ClockAngle();
idopontok2.Add(idopont);
}
}
}
string path2 = @"..\..\..\Sources\szogek.txt";
var data2 = File.ReadAllText(path2).Split(' ');
List<double> anglesToLookFor = new List<double>();
foreach (var item in data2)
{
string formattedItem = item.Replace('.', ',');
anglesToLookFor.Add(Double.Parse(formattedItem));
}
int counter = 0;
int iterations = 0;
int napokCounter = 0;
foreach (var item in idopontok2)
{
if (counter == anglesToLookFor.Count)
{
break;
}
if (item.Angle == anglesToLookFor[counter])
{
counter++;
}
iterations++;
if (iterations == 1440)
{
napokCounter++;
}
}
Console.WriteLine($"{napokCounter}|{idopontok2[iterations].Name}");
}
}
}

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Program</RootNamespace>
<AssemblyName>Program</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Idopont.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35818.85 d17.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Program", "Program.csproj", "{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41CA5E6D-695E-47A8-9C50-9B4BFF31D3A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7ADC66C7-D1D5-4782-AAD7-F0F034A36A02}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Program")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Program")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("41ca5e6d-695e-47a8-9c50-9b4bff31d3a5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Binary file not shown.

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

Binary file not shown.

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]

View File

@ -0,0 +1 @@
c2e1d7ce1c7e0d410616fd2841f24237f518162bfda30743ce1270bdade96f79

View File

@ -0,0 +1,7 @@
E:\Házi\13.osztály\Neumann_Verseny\fordulo_2\Program\bin\Debug\Program.exe.config
E:\Házi\13.osztály\Neumann_Verseny\fordulo_2\Program\bin\Debug\Program.exe
E:\Házi\13.osztály\Neumann_Verseny\fordulo_2\Program\bin\Debug\Program.pdb
E:\Házi\13.osztály\Neumann_Verseny\fordulo_2\Program\obj\Debug\Program.csproj.AssemblyReference.cache
E:\Házi\13.osztály\Neumann_Verseny\fordulo_2\Program\obj\Debug\Program.csproj.CoreCompileInputs.cache
E:\Házi\13.osztály\Neumann_Verseny\fordulo_2\Program\obj\Debug\Program.exe
E:\Házi\13.osztály\Neumann_Verseny\fordulo_2\Program\obj\Debug\Program.pdb

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
5144456432344334665332125452312653253613463222414453342631341112233631436116424661413113124334633124642544142212145233424645323553562315345634641456664413223652246422632141522354446531341646122515234646556232154514162132613352462365215563663424525663413653112415222166153661213431341426156353254356115516655123351366162611266643163511535554656613412

View File

@ -0,0 +1 @@
0011100110111110110000011101001000111100011110101100110010111100011010111111001111010101111010011000011111111101001110101010011001111010111101010101110111101111010100111011110101011110010110110101111100111110011110001111010011111101100111011110101001110011001111011100011011101101111010110100101110100000111111010100101000111011100111110001110011101

View File

@ -0,0 +1,60 @@
1 29
1 36
2 12
2 18
3 47
3 49
3 50
4 6
4 16
4 19
4 45
4 48
5 0
5 5
5 8
5 11
5 41
5 52
6 43
6 52
6 57
7 13
7 15
7 30
7 43
8 29
8 50
9 18
10 12
10 26
11 22
11 33
12 26
12 28
13 13
13 21
13 26
13 32
13 35
14 29
14 35
14 50
15 27
15 35
17 0
17 11
17 23
17 43
17 56
18 47
19 22
19 25
19 38
20 1
20 24
22 9
22 17
22 26
22 56
23 18

View File

@ -0,0 +1 @@
127.5 143 58.5 126 144 39 132.5 133.5 41.5 122.5 158 85.5 8 153.5 78.5 89.5 1 106 146 108