4594 | 2023-03-30 10:38:15 | TortelliniJr | Kert (75 pont) | csharp | Forditási hiba |
using System;
using System.Linq;
using System.Collections.Generic;
namespace Kert
{
class Program
{
static void Main(string[] args)
{
int[] inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
List<int> temp = new List<int>();
int dom = 0;
int azonosmax = 0;
for (int i = 0; i < inp[0]; i++)
{
temp = Console.ReadLine().Split().Select(int.Parse).ToList();
int most = temp.GroupBy(i => i).OrderByDescending(grp => grp.Count()).First().Count();
if (most > inp[1] / 2)
{
dom++;
}
int longestSeriesCount = temp.Skip(1)
.Aggregate(new { Value = temp[0], Count = 1, Longest = new { Value = temp[0], Count = 1 } },
(acc, x) => x == acc.Value ? new { Value = x, Count = acc.Count + 1, Longest = acc.Count + 1 > acc.Longest.Count ? new { Value = x, Count = acc.Count + 1 } : acc.Longest } :
new { Value = x, Count = 1, Longest = acc.Longest })
.Longest.Count;
if (longestSeriesCount > azonosmax)
{
azonosmax = longestSeriesCount;
}
}
Console.WriteLine(dom);
Console.WriteLine(azonosmax);
}
}
}
exit status 1
Compilation failed: 1 error(s), 0 warnings
main.cs(17,41): error CS0136: A local variable named `i' cannot be declared in this scope because it would give a different meaning to `i', which is already used in a `parent or current' scope to denote something else
Exited with error status 1