This commit is contained in:
nik
2025-09-30 14:26:54 +03:00
parent 8bd93df2ae
commit 8164e04835
633 changed files with 8 additions and 8 deletions

View File

@@ -0,0 +1,81 @@
using System;
class Program
{
static int VariantFromStudentNumber(int n) => (n % 2 != 0) ? 1 : 2;
static int ScoreVariant1(double x, double y)
{
var r = Math.Sqrt(x * x + y * y);
if (r <= 1) return 10;
if (r <= 2) return 5;
if (r <= 3) return 2;
return 0;
}
static int Sector(double x, double y)
{
var a = Math.Atan2(y, x);
if (a > Math.PI / 4 && a <= 3 * Math.PI / 4) return 1;
if (a > -Math.PI / 4 && a <= Math.PI / 4) return 5;
if (a > -3 * Math.PI / 4 && a <= -Math.PI / 4) return 2;
return 3;
}
static int ScoreVariant2(double x, double y)
{
var r = Math.Sqrt(x * x + y * y);
if (r <= 1) return 10;
if (r <= 3) return Sector(x, y);
return 0;
}
static void Main()
{
Console.Write("Номер по списку: ");
int student = int.Parse(Console.ReadLine());
int variant = VariantFromStudentNumber(student);
Console.Write("Сколько выстрелов: ");
int n = int.Parse(Console.ReadLine());
Console.Write("Случайный центр? (y/n): ");
bool rndCenter = Console.ReadLine().Trim().ToLower() == "y";
Console.Write("Случайная помеха? (y/n): ");
bool noise = Console.ReadLine().Trim().ToLower() == "y";
var rnd = new Random();
double cx = 0, cy = 0;
if (rndCenter)
{
cx = rnd.NextDouble() * 2 - 1;
cy = rnd.NextDouble() * 2 - 1;
}
int sum = 0;
for (int i = 0; i < n; i++)
{
Console.Write($"Выстрел {i + 1} (x y): ");
var parts = Console.ReadLine().Trim().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
double x = double.Parse(parts[0]);
double y = double.Parse(parts[1]);
if (noise)
{
x += (rnd.NextDouble() * 0.2 - 0.1);
y += (rnd.NextDouble() * 0.2 - 0.1);
}
x -= cx;
y -= cy;
int s = variant == 1 ? ScoreVariant1(x, y) : ScoreVariant2(x, y);
sum += s;
Console.WriteLine($"Очки: {s}, сумма: {sum}");
}
Console.WriteLine($"Итоговая сумма: {sum}");
}
}

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>

Binary file not shown.

View File

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

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("Shooting")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8bd93df2aef7759930e05e648a2010f5b8955d40")]
[assembly: System.Reflection.AssemblyProductAttribute("Shooting")]
[assembly: System.Reflection.AssemblyTitleAttribute("Shooting")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@@ -0,0 +1 @@
8d172992e8aac3890b77dfb6a31685d1b4d8e91942a035fc3b6c1f3b98bec76d

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 = Shooting
build_property.ProjectDir = /home/nik/oop/labs/lab3/Shooting/
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 @@
1f058371143e7a656a4e91083a01ae42a1518a348edd2f420f7d145069e5cc8e

View File

@@ -0,0 +1,14 @@
/home/nik/oop/labs/lab3/Shooting/bin/Debug/net9.0/Shooting
/home/nik/oop/labs/lab3/Shooting/bin/Debug/net9.0/Shooting.deps.json
/home/nik/oop/labs/lab3/Shooting/bin/Debug/net9.0/Shooting.runtimeconfig.json
/home/nik/oop/labs/lab3/Shooting/bin/Debug/net9.0/Shooting.dll
/home/nik/oop/labs/lab3/Shooting/bin/Debug/net9.0/Shooting.pdb
/home/nik/oop/labs/lab3/Shooting/obj/Debug/net9.0/Shooting.GeneratedMSBuildEditorConfig.editorconfig
/home/nik/oop/labs/lab3/Shooting/obj/Debug/net9.0/Shooting.AssemblyInfoInputs.cache
/home/nik/oop/labs/lab3/Shooting/obj/Debug/net9.0/Shooting.AssemblyInfo.cs
/home/nik/oop/labs/lab3/Shooting/obj/Debug/net9.0/Shooting.csproj.CoreCompileInputs.cache
/home/nik/oop/labs/lab3/Shooting/obj/Debug/net9.0/Shooting.dll
/home/nik/oop/labs/lab3/Shooting/obj/Debug/net9.0/refint/Shooting.dll
/home/nik/oop/labs/lab3/Shooting/obj/Debug/net9.0/Shooting.pdb
/home/nik/oop/labs/lab3/Shooting/obj/Debug/net9.0/Shooting.genruntimeconfig.cache
/home/nik/oop/labs/lab3/Shooting/obj/Debug/net9.0/ref/Shooting.dll

Binary file not shown.

View File

@@ -0,0 +1 @@
0c4df3c05762219e4c1640c530fa82db089504fe3599a3b04c6d6d7b86c2589e

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,73 @@
{
"format": 1,
"restore": {
"/home/nik/oop/labs/lab3/Shooting/Shooting.csproj": {}
},
"projects": {
"/home/nik/oop/labs/lab3/Shooting/Shooting.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/nik/oop/labs/lab3/Shooting/Shooting.csproj",
"projectName": "Shooting",
"projectPath": "/home/nik/oop/labs/lab3/Shooting/Shooting.csproj",
"packagesPath": "/home/nik/.nuget/packages/",
"outputPath": "/home/nik/oop/labs/lab3/Shooting/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/nik/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net9.0"
],
"sources": {
"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.100"
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Ref",
"version": "[9.0.9, 9.0.9]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/9.0.110/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@@ -0,0 +1,15 @@
<?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)' == '' ">/home/nik/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/nik/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.4</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/nik/.nuget/packages/" />
</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,78 @@
{
"version": 3,
"targets": {
"net9.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net9.0": []
},
"packageFolders": {
"/home/nik/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/nik/oop/labs/lab3/Shooting/Shooting.csproj",
"projectName": "Shooting",
"projectPath": "/home/nik/oop/labs/lab3/Shooting/Shooting.csproj",
"packagesPath": "/home/nik/.nuget/packages/",
"outputPath": "/home/nik/oop/labs/lab3/Shooting/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/nik/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net9.0"
],
"sources": {
"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.100"
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Ref",
"version": "[9.0.9, 9.0.9]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/9.0.110/PortableRuntimeIdentifierGraph.json"
}
}
}
}

View File

@@ -0,0 +1,10 @@
{
"version": 2,
"dgSpecHash": "hu2JUhn5aQk=",
"success": true,
"projectFilePath": "/home/nik/oop/labs/lab3/Shooting/Shooting.csproj",
"expectedPackageFiles": [
"/home/nik/.nuget/packages/microsoft.aspnetcore.app.ref/9.0.9/microsoft.aspnetcore.app.ref.9.0.9.nupkg.sha512"
],
"logs": []
}