23 lines
691 B
C#
23 lines
691 B
C#
|
using System.Text;
|
|||
|
|
|||
|
int[] numbers = File.ReadAllLines("/var/data/data.txt").Select(x=> int.Parse(x)).ToArray();
|
|||
|
int minNumber = int.MaxValue;
|
|||
|
int minNumberCount = 0;
|
|||
|
foreach(var number in numbers){
|
|||
|
if(number > minNumber){
|
|||
|
continue;
|
|||
|
}
|
|||
|
if(number == minNumber){
|
|||
|
minNumberCount++;
|
|||
|
continue;
|
|||
|
}
|
|||
|
if(number < minNumber){
|
|||
|
minNumber = number;
|
|||
|
minNumberCount = 1;
|
|||
|
}
|
|||
|
}
|
|||
|
using(FileStream fstream = new FileStream("/var/result/result.txt", FileMode.OpenOrCreate)){
|
|||
|
byte[] buffer = Encoding.Default.GetBytes(minNumberCount.ToString());
|
|||
|
await fstream.WriteAsync(buffer, 0, buffer.Length);
|
|||
|
}
|
|||
|
Console.WriteLine(minNumberCount);
|