12138 | 2024-12-03 20:21:12 | Tibi23 | Hőségriadó (50 pont) | csharp | Compilation error |
using System;
namespace hosegriado
{
class Program
{
static void Main(string[] args)
{
List<int> homerseklet = new List<int>();
int N, K, L, F;
String[] darabok = Console.ReadLine().Split(' ');
N = int.Parse(darabok[0]);
K = int.Parse(darabok[1]);
L = int.Parse(darabok[2]);
F = int.Parse(darabok[3]);
darabok = Console.ReadLine().Split(' ');
int[] homerseklettomb = new int[N];
for (int i = 0; i < N; i++) //i < darabok.Length
{
homerseklettomb[i] = int.Parse(darabok[i]);
}
foreach (string d in darabok)
{
homerseklet.Add(int.Parse(d));
}
int melegnapokszama = 0;
int huvosebbnapokszama = 0;
bool hosegriadoVan = false;
int hosegRdb = 0;
for (int i = 1; i < N; i++)
{
if (homerseklet[i] > F)
{
melegnapokszama++;
huvosebbnapokszama = 0;
}
if (homerseklet[i] < F)
{
huvosebbnapokszama++;
melegnapokszama = 0;
}
if (melegnapokszama == K && hosegriadoVan == false)
{
hosegRdb++;
hosegriadoVan = true;
}
if (huvosebbnapokszama == L && hosegriadoVan == true)
{
hosegriadoVan = false;
}
}
Console.WriteLine(hosegRdb);
}
}
}
open /var/local/lib/isolate/418/box/main.exe: no such file or directory
main.cs(10,13): error CS0246: The type or namespace name `List' could not be found. Are you missing `System.Collections.Generic' using directive?
main.cs(31,17): error CS0841: A local variable `homerseklet' cannot be used before it is declared
main.cs(40,21): error CS0841: A local variable `homerseklet' cannot be used before it is declared
main.cs(45,21): error CS0841: A local variable `homerseklet' cannot be used before it is declared
Compilation failed: 4 error(s), 0 warnings