├── .gitignore ├── ExamContest Template ├── ExamContest.sln ├── TaskA │ ├── Battlefield.cs │ ├── Battleship.cs │ ├── Cruiser.cs │ ├── Destroyer.cs │ ├── Program.cs │ ├── Ship.cs │ ├── Submarine.cs │ └── TaskA.csproj ├── TaskB │ ├── Commit.cs │ ├── Program.cs │ └── TaskB.csproj ├── TaskC │ ├── Gnome.cs │ ├── Program.cs │ └── TaskC.csproj ├── TaskD │ ├── Program.cs │ ├── Pupil.cs │ ├── School.cs │ ├── SchoolManager.cs │ └── TaskD.csproj ├── TaskE │ ├── IPlayer.cs │ ├── Player.cs │ ├── Program.cs │ ├── TaskE.csproj │ └── Team.cs ├── TaskF │ ├── Figure.cs │ ├── IFigure.cs │ ├── IFigureExtensions.cs │ ├── Point.cs │ ├── Program.cs │ └── TaskF.csproj ├── TaskG │ ├── Planet.cs │ ├── Program.StarSystem.cs │ ├── Program.cs │ └── TaskG.csproj ├── TaskH │ ├── Program.cs │ ├── StringByStringReader.cs │ └── TaskH.csproj ├── TaskI │ ├── Element.cs │ ├── Program.Layout.cs │ ├── Program.cs │ └── TaskI.csproj └── TaskJ │ ├── Program.StudentMarks.cs │ ├── Program.cs │ ├── Student.cs │ ├── StudentMark.cs │ ├── TaskJ.csproj │ └── Work.cs └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | #Mac temp files 7 | __MACOSX/ 8 | 9 | # User-specific files 10 | *.rsuser 11 | *.suo 12 | *.user 13 | *.userosscache 14 | *.sln.docstates 15 | 16 | # User-specific files (MonoDevelop/Xamarin Studio) 17 | *.userprefs 18 | 19 | # Mono auto generated files 20 | mono_crash.* 21 | 22 | # Build results 23 | [Dd]ebug/ 24 | [Dd]ebugPublic/ 25 | [Rr]elease/ 26 | [Rr]eleases/ 27 | x64/ 28 | x86/ 29 | [Aa][Rr][Mm]/ 30 | [Aa][Rr][Mm]64/ 31 | bld/ 32 | [Bb]in/ 33 | [Oo]bj/ 34 | [Ll]og/ 35 | [Ll]ogs/ 36 | .DS_Store 37 | .DS_Store/ 38 | .idea/ 39 | .vs/ 40 | 41 | # Visual Studio 2015/2017 cache/options directory 42 | .vs/ 43 | # Uncomment if you have tasks that create the project's static files in wwwroot 44 | #wwwroot/ 45 | 46 | # Visual Studio 2017 auto generated files 47 | Generated\ Files/ 48 | 49 | # MSTest test Results 50 | [Tt]est[Rr]esult*/ 51 | [Bb]uild[Ll]og.* 52 | 53 | # NUnit 54 | *.VisualState.xml 55 | TestResult.xml 56 | nunit-*.xml 57 | 58 | # Build Results of an ATL Project 59 | [Dd]ebugPS/ 60 | [Rr]eleasePS/ 61 | dlldata.c 62 | 63 | # Benchmark Results 64 | BenchmarkDotNet.Artifacts/ 65 | 66 | # .NET Core 67 | project.lock.json 68 | project.fragment.lock.json 69 | artifacts/ 70 | 71 | # StyleCop 72 | StyleCopReport.xml 73 | 74 | # Files built by Visual Studio 75 | *_i.c 76 | *_p.c 77 | *_h.h 78 | *.ilk 79 | *.meta 80 | *.obj 81 | *.iobj 82 | *.pch 83 | *.pdb 84 | *.ipdb 85 | *.pgc 86 | *.pgd 87 | *.rsp 88 | *.sbr 89 | *.tlb 90 | *.tli 91 | *.tlh 92 | *.tmp 93 | *.tmp_proj 94 | *_wpftmp.csproj 95 | *.log 96 | *.vspscc 97 | *.vssscc 98 | .builds 99 | *.pidb 100 | *.svclog 101 | *.scc 102 | 103 | # Chutzpah Test files 104 | _Chutzpah* 105 | 106 | # Visual C++ cache files 107 | ipch/ 108 | *.aps 109 | *.ncb 110 | *.opendb 111 | *.opensdf 112 | *.sdf 113 | *.cachefile 114 | *.VC.db 115 | *.VC.VC.opendb 116 | 117 | # Visual Studio profiler 118 | *.psess 119 | *.vsp 120 | *.vspx 121 | *.sap 122 | 123 | # Visual Studio Trace Files 124 | *.e2e 125 | 126 | # TFS 2012 Local Workspace 127 | $tf/ 128 | 129 | # Guidance Automation Toolkit 130 | *.gpState 131 | 132 | # ReSharper is a .NET coding add-in 133 | _ReSharper*/ 134 | *.[Rr]e[Ss]harper 135 | *.DotSettings.user 136 | 137 | # TeamCity is a build add-in 138 | _TeamCity* 139 | 140 | # DotCover is a Code Coverage Tool 141 | *.dotCover 142 | 143 | # AxoCover is a Code Coverage Tool 144 | .axoCover/* 145 | !.axoCover/settings.json 146 | 147 | # Visual Studio code coverage results 148 | *.coverage 149 | *.coveragexml 150 | 151 | # NCrunch 152 | _NCrunch_* 153 | .*crunch*.local.xml 154 | nCrunchTemp_* 155 | 156 | # MightyMoose 157 | *.mm.* 158 | AutoTest.Net/ 159 | 160 | # Web workbench (sass) 161 | .sass-cache/ 162 | 163 | # Installshield output folder 164 | [Ee]xpress/ 165 | 166 | # DocProject is a documentation generator add-in 167 | DocProject/buildhelp/ 168 | DocProject/Help/*.HxT 169 | DocProject/Help/*.HxC 170 | DocProject/Help/*.hhc 171 | DocProject/Help/*.hhk 172 | DocProject/Help/*.hhp 173 | DocProject/Help/Html2 174 | DocProject/Help/html 175 | 176 | # Click-Once directory 177 | publish/ 178 | 179 | # Publish Web Output 180 | *.[Pp]ublish.xml 181 | *.azurePubxml 182 | # Note: Comment the next line if you want to checkin your web deploy settings, 183 | # but database connection strings (with potential passwords) will be unencrypted 184 | *.pubxml 185 | *.publishproj 186 | 187 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 188 | # checkin your Azure Web App publish settings, but sensitive information contained 189 | # in these scripts will be unencrypted 190 | PublishScripts/ 191 | 192 | # NuGet Packages 193 | *.nupkg 194 | # NuGet Symbol Packages 195 | *.snupkg 196 | # The packages folder can be ignored because of Package Restore 197 | **/[Pp]ackages/* 198 | # except build/, which is used as an MSBuild target. 199 | !**/[Pp]ackages/build/ 200 | # Uncomment if necessary however generally it will be regenerated when needed 201 | #!**/[Pp]ackages/repositories.config 202 | # NuGet v3's project.json files produces more ignorable files 203 | *.nuget.props 204 | *.nuget.targets 205 | 206 | # Microsoft Azure Build Output 207 | csx/ 208 | *.build.csdef 209 | 210 | # Microsoft Azure Emulator 211 | ecf/ 212 | rcf/ 213 | 214 | # Windows Store app package directories and files 215 | AppPackages/ 216 | BundleArtifacts/ 217 | Package.StoreAssociation.xml 218 | _pkginfo.txt 219 | *.appx 220 | *.appxbundle 221 | *.appxupload 222 | 223 | # Visual Studio cache files 224 | # files ending in .cache can be ignored 225 | *.[Cc]ache 226 | # but keep track of directories ending in .cache 227 | !?*.[Cc]ache/ 228 | 229 | # Others 230 | ClientBin/ 231 | ~$* 232 | *~ 233 | *.dbmdl 234 | *.dbproj.schemaview 235 | *.jfm 236 | *.pfx 237 | *.publishsettings 238 | orleans.codegen.cs 239 | 240 | # Including strong name files can present a security risk 241 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 242 | #*.snk 243 | 244 | # Since there are multiple workflows, uncomment next line to ignore bower_components 245 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 246 | #bower_components/ 247 | 248 | # RIA/Silverlight projects 249 | Generated_Code/ 250 | 251 | # Backup & report files from converting an old project file 252 | # to a newer Visual Studio version. Backup files are not needed, 253 | # because we have git ;-) 254 | _UpgradeReport_Files/ 255 | Backup*/ 256 | UpgradeLog*.XML 257 | UpgradeLog*.htm 258 | ServiceFabricBackup/ 259 | *.rptproj.bak 260 | 261 | # SQL Server files 262 | *.mdf 263 | *.ldf 264 | *.ndf 265 | 266 | # Business Intelligence projects 267 | *.rdl.data 268 | *.bim.layout 269 | *.bim_*.settings 270 | *.rptproj.rsuser 271 | *- [Bb]ackup.rdl 272 | *- [Bb]ackup ([0-9]).rdl 273 | *- [Bb]ackup ([0-9][0-9]).rdl 274 | 275 | # Microsoft Fakes 276 | FakesAssemblies/ 277 | 278 | # GhostDoc plugin setting file 279 | *.GhostDoc.xml 280 | 281 | # Node.js Tools for Visual Studio 282 | .ntvs_analysis.dat 283 | node_modules/ 284 | 285 | # Visual Studio 6 build log 286 | *.plg 287 | 288 | # Visual Studio 6 workspace options file 289 | *.opt 290 | 291 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 292 | *.vbw 293 | 294 | # Visual Studio LightSwitch build output 295 | **/*.HTMLClient/GeneratedArtifacts 296 | **/*.DesktopClient/GeneratedArtifacts 297 | **/*.DesktopClient/ModelManifest.xml 298 | **/*.Server/GeneratedArtifacts 299 | **/*.Server/ModelManifest.xml 300 | _Pvt_Extensions 301 | 302 | # Paket dependency manager 303 | .paket/paket.exe 304 | paket-files/ 305 | 306 | # FAKE - F# Make 307 | .fake/ 308 | 309 | # CodeRush personal settings 310 | .cr/personal 311 | 312 | # Python Tools for Visual Studio (PTVS) 313 | __pycache__/ 314 | *.pyc 315 | 316 | # Cake - Uncomment if you are using it 317 | # tools/** 318 | # !tools/packages.config 319 | 320 | # Tabs Studio 321 | *.tss 322 | 323 | # Telerik's JustMock configuration file 324 | *.jmconfig 325 | 326 | # BizTalk build output 327 | *.btp.cs 328 | *.btm.cs 329 | *.odx.cs 330 | *.xsd.cs 331 | 332 | # OpenCover UI analysis results 333 | OpenCover/ 334 | 335 | # Azure Stream Analytics local run output 336 | ASALocalRun/ 337 | 338 | # MSBuild Binary and Structured Log 339 | *.binlog 340 | 341 | # NVidia Nsight GPU debugger configuration file 342 | *.nvuser 343 | 344 | # MFractors (Xamarin productivity tool) working folder 345 | .mfractor/ 346 | 347 | # Local History for Visual Studio 348 | .localhistory/ 349 | 350 | # BeatPulse healthcheck temp database 351 | healthchecksdb 352 | 353 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 354 | MigrationBackup/ 355 | 356 | # Ionide (cross platform F# VS Code tools) working folder 357 | .ionide/ 358 | -------------------------------------------------------------------------------- /ExamContest Template/ExamContest.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskA", "TaskA\TaskA.csproj", "{4D1762BD-B859-48F6-A8C9-C0608BD44803}" 4 | EndProject 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskD", "TaskD\TaskD.csproj", "{E5E97DF0-7B5D-40E6-88C0-DABAF69A11A6}" 6 | EndProject 7 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskB", "TaskB\TaskB.csproj", "{236C47EE-AA8C-4260-8A8E-E0B2F3EC6F56}" 8 | EndProject 9 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskC", "TaskC\TaskC.csproj", "{5237A5F0-2217-4442-BA1A-38CBA26EAB26}" 10 | EndProject 11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskE", "TaskE\TaskE.csproj", "{84C1EB49-6356-494F-A301-E98B0AB626F7}" 12 | EndProject 13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskF", "TaskF\TaskF.csproj", "{1A6421DF-0041-495C-B3AC-828AD6D65761}" 14 | EndProject 15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskG", "TaskG\TaskG.csproj", "{21302275-C5FC-4CCE-88C2-859981AC1F81}" 16 | EndProject 17 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskH", "TaskH\TaskH.csproj", "{99C9AABE-D41F-4DAF-9261-B1461F36E84A}" 18 | EndProject 19 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskI", "TaskI\TaskI.csproj", "{EF444BCA-21F7-41E6-92DF-3E8272864E9A}" 20 | EndProject 21 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskJ", "TaskJ\TaskJ.csproj", "{B8BD591A-6EC1-4350-9417-6BB646C53957}" 22 | EndProject 23 | Global 24 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 25 | Debug|Any CPU = Debug|Any CPU 26 | Release|Any CPU = Release|Any CPU 27 | EndGlobalSection 28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 29 | {4D1762BD-B859-48F6-A8C9-C0608BD44803}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 30 | {4D1762BD-B859-48F6-A8C9-C0608BD44803}.Debug|Any CPU.Build.0 = Debug|Any CPU 31 | {4D1762BD-B859-48F6-A8C9-C0608BD44803}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {4D1762BD-B859-48F6-A8C9-C0608BD44803}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {E5E97DF0-7B5D-40E6-88C0-DABAF69A11A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 34 | {E5E97DF0-7B5D-40E6-88C0-DABAF69A11A6}.Debug|Any CPU.Build.0 = Debug|Any CPU 35 | {E5E97DF0-7B5D-40E6-88C0-DABAF69A11A6}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {E5E97DF0-7B5D-40E6-88C0-DABAF69A11A6}.Release|Any CPU.Build.0 = Release|Any CPU 37 | {236C47EE-AA8C-4260-8A8E-E0B2F3EC6F56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 38 | {236C47EE-AA8C-4260-8A8E-E0B2F3EC6F56}.Debug|Any CPU.Build.0 = Debug|Any CPU 39 | {236C47EE-AA8C-4260-8A8E-E0B2F3EC6F56}.Release|Any CPU.ActiveCfg = Release|Any CPU 40 | {236C47EE-AA8C-4260-8A8E-E0B2F3EC6F56}.Release|Any CPU.Build.0 = Release|Any CPU 41 | {5237A5F0-2217-4442-BA1A-38CBA26EAB26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 42 | {5237A5F0-2217-4442-BA1A-38CBA26EAB26}.Debug|Any CPU.Build.0 = Debug|Any CPU 43 | {5237A5F0-2217-4442-BA1A-38CBA26EAB26}.Release|Any CPU.ActiveCfg = Release|Any CPU 44 | {5237A5F0-2217-4442-BA1A-38CBA26EAB26}.Release|Any CPU.Build.0 = Release|Any CPU 45 | {84C1EB49-6356-494F-A301-E98B0AB626F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 46 | {84C1EB49-6356-494F-A301-E98B0AB626F7}.Debug|Any CPU.Build.0 = Debug|Any CPU 47 | {84C1EB49-6356-494F-A301-E98B0AB626F7}.Release|Any CPU.ActiveCfg = Release|Any CPU 48 | {84C1EB49-6356-494F-A301-E98B0AB626F7}.Release|Any CPU.Build.0 = Release|Any CPU 49 | {1A6421DF-0041-495C-B3AC-828AD6D65761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 50 | {1A6421DF-0041-495C-B3AC-828AD6D65761}.Debug|Any CPU.Build.0 = Debug|Any CPU 51 | {1A6421DF-0041-495C-B3AC-828AD6D65761}.Release|Any CPU.ActiveCfg = Release|Any CPU 52 | {1A6421DF-0041-495C-B3AC-828AD6D65761}.Release|Any CPU.Build.0 = Release|Any CPU 53 | {21302275-C5FC-4CCE-88C2-859981AC1F81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 54 | {21302275-C5FC-4CCE-88C2-859981AC1F81}.Debug|Any CPU.Build.0 = Debug|Any CPU 55 | {21302275-C5FC-4CCE-88C2-859981AC1F81}.Release|Any CPU.ActiveCfg = Release|Any CPU 56 | {21302275-C5FC-4CCE-88C2-859981AC1F81}.Release|Any CPU.Build.0 = Release|Any CPU 57 | {99C9AABE-D41F-4DAF-9261-B1461F36E84A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 58 | {99C9AABE-D41F-4DAF-9261-B1461F36E84A}.Debug|Any CPU.Build.0 = Debug|Any CPU 59 | {99C9AABE-D41F-4DAF-9261-B1461F36E84A}.Release|Any CPU.ActiveCfg = Release|Any CPU 60 | {99C9AABE-D41F-4DAF-9261-B1461F36E84A}.Release|Any CPU.Build.0 = Release|Any CPU 61 | {EF444BCA-21F7-41E6-92DF-3E8272864E9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 62 | {EF444BCA-21F7-41E6-92DF-3E8272864E9A}.Debug|Any CPU.Build.0 = Debug|Any CPU 63 | {EF444BCA-21F7-41E6-92DF-3E8272864E9A}.Release|Any CPU.ActiveCfg = Release|Any CPU 64 | {EF444BCA-21F7-41E6-92DF-3E8272864E9A}.Release|Any CPU.Build.0 = Release|Any CPU 65 | {B8BD591A-6EC1-4350-9417-6BB646C53957}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 66 | {B8BD591A-6EC1-4350-9417-6BB646C53957}.Debug|Any CPU.Build.0 = Debug|Any CPU 67 | {B8BD591A-6EC1-4350-9417-6BB646C53957}.Release|Any CPU.ActiveCfg = Release|Any CPU 68 | {B8BD591A-6EC1-4350-9417-6BB646C53957}.Release|Any CPU.Build.0 = Release|Any CPU 69 | EndGlobalSection 70 | EndGlobal 71 | -------------------------------------------------------------------------------- /ExamContest Template/TaskA/Battlefield.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | public class Battlefield 4 | { 5 | private readonly Ship[,] ships; 6 | 7 | public Battlefield(Ship[,] ships) 8 | { 9 | this.ships = ships; 10 | } 11 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskA/Battleship.cs: -------------------------------------------------------------------------------- 1 | public class Battleship 2 | { 3 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskA/Cruiser.cs: -------------------------------------------------------------------------------- 1 | public class Cruiser 2 | { 3 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskA/Destroyer.cs: -------------------------------------------------------------------------------- 1 | public class Destroyer 2 | { 3 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskA/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | public class Program 5 | { 6 | private static void PlaceShip(string[] shipData, Ship[,] ships) where T : Ship, new() 7 | { 8 | Ship ship = new T 9 | { 10 | BowRow = int.Parse(shipData[1]), 11 | BowColumn = int.Parse(shipData[2]), 12 | IsHorizontal = bool.Parse(shipData[3]) 13 | }; 14 | 15 | if (ship.IsHorizontal) { 16 | for (var j = ship.BowColumn; j < ship.BowColumn + ship.Length; ++j) { 17 | ships[ship.BowRow, j] = ship; 18 | } 19 | } else { 20 | for (var i = ship.BowRow; i < ship.BowRow+ ship.Length; ++i) { 21 | ships[i, ship.BowColumn] = ship; 22 | } 23 | } 24 | } 25 | 26 | public static void Main(string[] args) 27 | { 28 | Ship[,] ships = new Ship[10, 10]; 29 | 30 | using (var sr = new StreamReader("ships.txt")) 31 | { 32 | int shipsCount = 0; 33 | while (shipsCount != 10) 34 | { 35 | string[] shipData = sr.ReadLine().Split(); 36 | ++shipsCount; 37 | 38 | switch (shipData[0]) 39 | { 40 | case nameof(Submarine): 41 | PlaceShip(shipData, ships); 42 | break; 43 | case nameof(Destroyer): 44 | PlaceShip(shipData, ships); 45 | break; 46 | case nameof(Cruiser): 47 | PlaceShip(shipData, ships); 48 | break; 49 | case nameof(Battleship): 50 | PlaceShip(shipData, ships); 51 | break; 52 | } 53 | } 54 | 55 | var battlefield = new Battlefield(ships); 56 | 57 | while (!sr.EndOfStream) 58 | { 59 | int[] coordinates = Array.ConvertAll(sr.ReadLine().Split(), int.Parse); 60 | Console.WriteLine(battlefield[coordinates[0], coordinates[1]]); 61 | } 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskA/Ship.cs: -------------------------------------------------------------------------------- 1 | public abstract class Ship 2 | { 3 | /// 4 | /// The row (0 to 9) which contains the bow (front) of the ship. 5 | /// 6 | public int BowRow { get; set; } 7 | 8 | /// 9 | /// The column (0 to 9) which contains the bow (front) of the ship. 10 | /// 11 | public int BowColumn { get; set; } 12 | 13 | /// 14 | /// The number of squares occupied by the ship. 15 | /// 16 | public int Length { get; protected set; } 17 | 18 | /// 19 | /// An array of booleans telling whether that part of the ship has been hit. 20 | /// 21 | public bool[] Hit { get; protected set; } 22 | 23 | /// 24 | /// True if the ship occupies a single row, false otherwise. 25 | /// 26 | public bool IsHorizontal { get; set; } 27 | 28 | /// 29 | /// Name of the ship type. 30 | /// 31 | public abstract string ShipType { get; } 32 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskA/Submarine.cs: -------------------------------------------------------------------------------- 1 | public class Submarine 2 | { 3 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskA/TaskA.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExamContest Template/TaskB/Commit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Commit 4 | { 5 | private int id; 6 | private string content; 7 | public int Id => id; 8 | public string Content => content; 9 | 10 | public static Commit MergeAllCommits(Commit[] commits, Commit mergeIn, Func mergeCommits, 11 | Predicate canCommitMerged) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | 16 | public static Commit MergeCommits(Commit commit1, Commit commit2) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | 21 | public Commit(int id, string content) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskB/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Program 4 | { 5 | public static void Main(string[] args) 6 | { 7 | int n = int.Parse(Console.ReadLine()); 8 | 9 | var commits = new Commit[n]; 10 | for (int i = 0; i < n; i++) 11 | { 12 | String[] lineArgs = Console.ReadLine().Split(' '); 13 | commits[i] = new Commit(int.Parse(lineArgs[0]), lineArgs[1]); 14 | } 15 | 16 | string[] lastLineArgs = Console.ReadLine().Split(' '); 17 | var inMergeCommit = new Commit(int.Parse(lastLineArgs[0]), lastLineArgs[1]); 18 | 19 | try 20 | { 21 | Console.WriteLine(Commit.MergeAllCommits(commits, inMergeCommit, Commit.MergeCommits, 22 | commit => commit.Id < commit.Content.Length)); 23 | } 24 | catch (ArgumentException e) 25 | { 26 | Console.WriteLine(e.Message); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskB/TaskB.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExamContest Template/TaskC/Gnome.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Gnome 4 | { 5 | private double weight; 6 | private int height; 7 | 8 | public static Gnome GetGnome(string[] inputLines, double minWeight, int neededHeight) 9 | { 10 | throw new NotImplementedException(); 11 | } 12 | 13 | private Gnome(double weight, int height) 14 | { 15 | throw new NotImplementedException(); 16 | } 17 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskC/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Program 4 | { 5 | public static void Main(string[] args) 6 | { 7 | int n = int.Parse(Console.ReadLine()); 8 | string[] inputLines = new string[n]; 9 | 10 | for (int i = 0; i < n; i++) 11 | { 12 | inputLines[i] = Console.ReadLine(); 13 | } 14 | 15 | double minWeight = double.Parse(Console.ReadLine()); 16 | int neededHeight = int.Parse(Console.ReadLine()); 17 | 18 | try 19 | { 20 | Console.WriteLine(Gnome.GetGnome(inputLines, minWeight, neededHeight)); 21 | } 22 | catch (ArgumentException e) 23 | { 24 | Console.WriteLine(e.Message); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskC/TaskC.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExamContest Template/TaskD/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | 6 | public class Program 7 | { 8 | private static Pupil GetPupil(string[] pupilData) => 9 | new Pupil( 10 | firstName: pupilData[0], 11 | middleName: pupilData[1], 12 | lastName: pupilData[2], 13 | year: int.Parse(pupilData[3]), 14 | schoolNumber: pupilData[4] 15 | ); 16 | 17 | private static School GetSchool(string[] schoolData, List pupils) => 18 | new School( 19 | address: schoolData[0], 20 | schoolNumber: schoolData[1], 21 | pupils: pupils 22 | ); 23 | 24 | public static void Main(string[] args) 25 | { 26 | var pupils = new List(); 27 | var schools = new List(); 28 | 29 | using (var sr = new StreamReader("schools.txt")) 30 | { 31 | int pupilsNumber = int.Parse(sr.ReadLine()); 32 | while (pupilsNumber-- > 0) 33 | { 34 | pupils.Add(GetPupil(sr.ReadLine().Split())); 35 | } 36 | 37 | int schoolsNumber = int.Parse(sr.ReadLine()); 38 | while (schoolsNumber-- > 0) 39 | { 40 | schools.Add(GetSchool(sr.ReadLine().Split("; "), pupils)); 41 | } 42 | 43 | int commandsNumber = int.Parse(sr.ReadLine()); 44 | while (commandsNumber-- > 0) 45 | { 46 | string[] command = sr.ReadLine().Split(); 47 | switch (command[0]) 48 | { 49 | case "mv": 50 | SchoolManager.TransferPupil(pupils, schools, pupilId: int.Parse(command[1]), newSchoolNumber: command[2]); 51 | break; 52 | case "union": 53 | var schoolsNumbers = command.Skip(1).ToList(); 54 | SchoolManager.UniteSchools(schools, schoolsNumbers); 55 | break; 56 | case "close": 57 | SchoolManager.CloseSchool(schools, schoolNumber: command[1], newSchoolNumber: command[2]); 58 | break; 59 | } 60 | } 61 | } 62 | 63 | using (var sw = new StreamWriter("schools_after_reform.txt")) 64 | { 65 | schools.ForEach(sw.WriteLine); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskD/Pupil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Pupil 4 | { 5 | public int Id { get; } 6 | public string FirstName { get; } 7 | public string LastName { get; } 8 | public string MiddleName { get; } 9 | public int Year { get; } 10 | public string SchoolNumber { get; set; } 11 | 12 | public Pupil(string firstName, string middleName, string lastName, int year, string schoolNumber) 13 | { 14 | throw new NotImplementedException(); 15 | } 16 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskD/School.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | public class School 6 | { 7 | public string SchoolNumber { get; set; } 8 | public string Address { get; } 9 | public List Pupils { get; } 10 | 11 | public School(string address, string schoolNumber, List pupils) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskD/SchoolManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | public class SchoolManager 5 | { 6 | public static void UniteSchools(List schools, List schoolNumbers) 7 | { 8 | throw new NotImplementedException(); 9 | } 10 | 11 | public static void TransferPupil(List pupils, List schools, int pupilId, string newSchoolNumber) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | 16 | public static void CloseSchool(List schools, string schoolNumber, string newSchoolNumber) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskD/TaskD.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExamContest Template/TaskE/IPlayer.cs: -------------------------------------------------------------------------------- 1 | public interface IPlayer 2 | { 3 | public double Skill { get; } 4 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskE/Player.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Player : IPlayer 4 | { 5 | private readonly string name; 6 | private readonly int age; 7 | private readonly int speed; 8 | private readonly int shooting; 9 | 10 | private Player(string name, int age, int speed, int shooting) 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | 15 | public double Skill => throw new NotImplementedException(); 16 | 17 | public static Player Parse(string str) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskE/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Program 4 | { 5 | public static void Main(string[] args) 6 | { 7 | int n = int.Parse(Console.ReadLine()); 8 | int m = int.Parse(Console.ReadLine()); 9 | 10 | var firstTeam = new Team(); 11 | var secondTeam = new Team(); 12 | 13 | for (int i = 0; i < n; i++) 14 | { 15 | try 16 | { 17 | firstTeam += Player.Parse(Console.ReadLine()); 18 | } 19 | catch (ArgumentException argumentException) 20 | { 21 | Console.WriteLine(argumentException.Message); 22 | } 23 | } 24 | 25 | for (int i = 0; i < m; i++) 26 | { 27 | try 28 | { 29 | secondTeam += Player.Parse(Console.ReadLine()); 30 | } 31 | catch (ArgumentException argumentException) 32 | { 33 | Console.WriteLine(argumentException.Message); 34 | } 35 | } 36 | 37 | Console.WriteLine($"{firstTeam.Skill:F3}"); 38 | Console.WriteLine($"{secondTeam.Skill:F3}"); 39 | 40 | if (firstTeam.CompareTo(secondTeam) == 0) 41 | { 42 | Console.WriteLine("Teams are equal"); 43 | } 44 | else if (firstTeam > secondTeam && firstTeam.CompareTo(secondTeam) > 0) 45 | { 46 | Console.WriteLine("Team 1"); 47 | } 48 | else if (firstTeam < secondTeam && firstTeam.CompareTo(secondTeam) < 0) 49 | { 50 | Console.WriteLine("Team 2"); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskE/TaskE.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExamContest Template/TaskE/Team.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | public class Team 6 | { 7 | private List Players { get; } 8 | public double Skill => Players.Sum(x => x.Skill); 9 | 10 | public Team() 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskF/Figure.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | public class Figure : IFigure 5 | { 6 | public List Points { get; } 7 | 8 | private Figure(List points) 9 | { 10 | Points = points; 11 | } 12 | 13 | public static Figure Parse(string str) 14 | { 15 | string[] words = str.Split(';'); 16 | 17 | var onePoint = Point.Parse(words[1]); 18 | var twoPoint = Point.Parse(words[2]); 19 | var threePoint = Point.Parse(words[3]); 20 | 21 | return words[0] switch 22 | { 23 | "Triangle" => new Figure(new List {onePoint, twoPoint, threePoint}), 24 | "Rectangle" => new Figure(new List {onePoint, twoPoint, threePoint, Point.Parse(words[4])}), 25 | _ => throw new ArgumentException("Incorrect input") 26 | }; 27 | } 28 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskF/IFigure.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | public interface IFigure 4 | { 5 | public List Points { get; } 6 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskF/IFigureExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public static class IFigureExtensions 4 | { 5 | public static double GetSquare(this IFigure iFigure) 6 | { 7 | throw new NotImplementedException(); 8 | } 9 | 10 | public static double GetPerimeter(this IFigure figure) 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskF/Point.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public struct Point 4 | { 5 | private readonly int x; 6 | private readonly int y; 7 | 8 | public int X => x; 9 | public int Y => y; 10 | private Point(int x, int y) 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | 15 | public static Point Parse(string str) 16 | { 17 | throw new NotImplementedException(); 18 | } 19 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskF/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Program 4 | { 5 | public static void Main(string[] args) 6 | { 7 | try 8 | { 9 | IFigure firstFigure = Figure.Parse(Console.ReadLine()); 10 | IFigure secondFigure = Figure.Parse(Console.ReadLine()); 11 | 12 | Console.WriteLine($"{firstFigure.GetPerimeter():F3} and {secondFigure.GetPerimeter():F3}"); 13 | Console.WriteLine($"{firstFigure.GetSquare():F3} and {secondFigure.GetSquare():F3}"); 14 | 15 | Console.WriteLine($"{firstFigure.CompareByPerimeter(secondFigure) > 0}"); 16 | Console.WriteLine($"{firstFigure.CompareBySquare(secondFigure) > 0}"); 17 | } 18 | catch (ArgumentException argumentException) 19 | { 20 | Console.WriteLine(argumentException.Message); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskF/TaskF.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExamContest Template/TaskG/Planet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | public class Planet 5 | { 6 | public int Id { get; } 7 | public string StarSystem { get; set; } 8 | public static List> Planets { get; } 9 | public T Name { get; } 10 | 11 | private Planet(int id, T name, string starSystem) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | 16 | public static void CreatePlanet(int id, T name, string starSystem) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /ExamContest Template/TaskG/Program.StarSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public partial class Program 4 | { 5 | private static void ChangeStarSystem(int id, string newStarSystem) 6 | { 7 | throw new NotImplementedException(); 8 | } 9 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskG/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | partial class Program 4 | { 5 | public static void Main(string[] args) 6 | { 7 | int n = int.Parse(Console.ReadLine()); 8 | for (int i = 0; i < n; i++) 9 | { 10 | string[] data = Console.ReadLine().Split(); 11 | switch (data[0]) 12 | { 13 | case "string": 14 | Planet.CreatePlanet(int.Parse(data[1]), data[2], data[3]); 15 | break; 16 | case "int": 17 | Planet.CreatePlanet(int.Parse(data[1]), int.Parse(data[2]), data[3]); 18 | break; 19 | default: 20 | ChangeStarSystem(int.Parse(data[1]), data[2]); 21 | break; 22 | } 23 | } 24 | 25 | Planet.Planets.ForEach(Console.WriteLine); 26 | Planet.Planets.ForEach(Console.WriteLine); 27 | } 28 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskG/TaskG.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExamContest Template/TaskH/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Program 4 | { 5 | public static void Main(string[] args) 6 | { 7 | string filename = Console.ReadLine(); 8 | int screenSize = int.Parse(Console.ReadLine()); 9 | var reader = new StringByStringReader(filename); 10 | 11 | foreach (var item in reader) 12 | { 13 | Console.WriteLine(item); 14 | } 15 | 16 | Console.WriteLine("-------"); 17 | 18 | foreach (var item in reader.CutStrings(screenSize)) 19 | { 20 | Console.WriteLine(item); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskH/StringByStringReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | class StringByStringReader 5 | { 6 | private string filename; 7 | public StringByStringReader(string filename) 8 | { 9 | this.filename = filename; 10 | } 11 | 12 | public IEnumerable CutStrings(int length) 13 | { 14 | throw new NotImplementedException(); 15 | } 16 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskH/TaskH.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExamContest Template/TaskI/Element.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class Element 4 | { 5 | public string Name { get; set; } 6 | public string Align { get; set; } 7 | public int PosX { get; set; } 8 | public int PosY { get; set; } 9 | 10 | public Element(string name, string align, int posX, int posY) 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ExamContest Template/TaskI/Program.Layout.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | partial class Program 5 | { 6 | private static void PlaceAll(List elements) 7 | { 8 | throw new NotImplementedException(); 9 | } 10 | 11 | private static void DumpData(List elements, string path) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskI/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | partial class Program 6 | { 7 | public static void Main(string[] args) 8 | { 9 | int n = int.Parse(Console.ReadLine()); 10 | List elements = new List(); 11 | for (int i = 0; i < n; i++) 12 | { 13 | string[] data = Console.ReadLine().Split(); 14 | elements.Add(new Element(data[0], data[1], int.Parse(data[2]), int.Parse(data[3]))); 15 | } 16 | 17 | try 18 | { 19 | PlaceAll(elements); 20 | } 21 | catch (FormatException e) 22 | { 23 | using (StreamWriter sw = new StreamWriter("output.xml")) 24 | { 25 | sw.WriteLine(e.Message); 26 | } 27 | return; 28 | } 29 | DumpData(elements, "output.xml"); 30 | } 31 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskI/TaskI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExamContest Template/TaskJ/Program.StudentMarks.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | partial class Program 5 | { 6 | private static IEnumerable GetStudentMarks(List students, List marks) 7 | { 8 | throw new NotImplementedException(); 9 | } 10 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskJ/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | partial class Program 5 | { 6 | public static void Main(string[] args) 7 | { 8 | List students = new List(); 9 | List marks = new List(); 10 | 11 | IEnumerable results = GetStudentMarks(students, marks); 12 | 13 | int students_count = int.Parse(Console.ReadLine()); 14 | int works_count = int.Parse(Console.ReadLine()); 15 | 16 | for (int i = 0; i < students_count; i++) 17 | { 18 | students.Add(Student.Parse(Console.ReadLine())); 19 | } 20 | 21 | for (int i = 0; i < works_count; i++) 22 | { 23 | marks.Add(Work.Parse(Console.ReadLine())); 24 | } 25 | 26 | 27 | foreach (var st in results) 28 | { 29 | Console.WriteLine($"{st.FIO} {st.Mark}"); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskJ/Student.cs: -------------------------------------------------------------------------------- 1 | class Student 2 | { 3 | private int id; 4 | private string fio; 5 | public int ID => id; 6 | public string FIO => fio; 7 | 8 | public Student(int id, string fio) 9 | { 10 | this.id = id; 11 | this.fio = fio; 12 | } 13 | 14 | public static Student Parse(string inp) 15 | { 16 | var arr = inp.Split(); 17 | return new Student(int.Parse(arr[0]), arr[1]); 18 | } 19 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskJ/StudentMark.cs: -------------------------------------------------------------------------------- 1 | class StudentMark 2 | { 3 | private string fio; 4 | private int mark; 5 | public string FIO => fio; 6 | public int Mark => mark; 7 | 8 | public StudentMark(string fio, int mark) 9 | { 10 | this.mark = mark; 11 | this.fio = fio; 12 | } 13 | } -------------------------------------------------------------------------------- /ExamContest Template/TaskJ/TaskJ.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExamContest Template/TaskJ/Work.cs: -------------------------------------------------------------------------------- 1 | class Work 2 | { 3 | private int id; 4 | private int mark; 5 | public int ID => id; 6 | public int Mark => mark; 7 | 8 | public Work(int id, int mark) 9 | { 10 | this.id = id; 11 | this.mark = mark; 12 | } 13 | 14 | public static Work Parse(string inp) 15 | { 16 | var arr = inp.Split(); 17 | return new Work(int.Parse(arr[0]), int.Parse(arr[1])); 18 | } 19 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Programming2020 --------------------------------------------------------------------------------