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