fix
This commit is contained in:
parent
c680a6e51d
commit
685fd6ab9b
@ -1,5 +0,0 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {}
|
||||
}
|
@ -2,11 +2,11 @@
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
|
||||
var dir = new DirectoryInfo("../var/data");
|
||||
var dir = new DirectoryInfo("/var/data");
|
||||
|
||||
var files = dir.GetFiles();
|
||||
|
||||
string resultFilePath = "../var/result/data.txt";
|
||||
string resultFilePath = "/var/result/data.txt";
|
||||
try
|
||||
{
|
||||
int[] mass = new int[files.Length];
|
||||
|
@ -1,32 +1,12 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
string[] lines = File.ReadAllLines("../var/data/data.txt");
|
||||
string[] lines = File.ReadAllLines("/var/data/data.txt");
|
||||
|
||||
int firstNumber = 0;
|
||||
int lastNumber = 0;
|
||||
int multiplication = Convert.ToInt32(lines.First()) * Convert.ToInt32(lines.Last());
|
||||
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (int.TryParse(line, out int number))
|
||||
{
|
||||
firstNumber = number;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = lines.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (int.TryParse(lines[i], out int number))
|
||||
{
|
||||
lastNumber = number;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int multiplication = firstNumber * lastNumber;
|
||||
|
||||
using (StreamWriter writer = new StreamWriter("../var/result/result.txt"))
|
||||
using (StreamWriter writer = new StreamWriter("/var/result/result.txt"))
|
||||
{
|
||||
writer.WriteLine(multiplication);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user