121372024-12-03 20:18:58Tibi23Hőségriadó (50 pont)csharpRuntime error 0/5014ms3056 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

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);

        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/014ms2748 KiB
2Runtime error0/014ms2952 KiB
3Runtime error0/214ms2836 KiB
4Runtime error0/214ms2772 KiB
5Runtime error0/214ms2844 KiB
6Runtime error0/214ms2804 KiB
7Runtime error0/214ms2744 KiB
8Runtime error0/414ms3004 KiB
9Runtime error0/414ms2856 KiB
10Runtime error0/414ms2524 KiB
11Runtime error0/414ms2896 KiB
12Runtime error0/414ms2760 KiB
13Runtime error0/414ms2636 KiB
14Runtime error0/414ms2848 KiB
15Runtime error0/414ms3056 KiB
16Runtime error0/414ms2868 KiB
17Runtime error0/414ms2620 KiB