60202023-10-24 08:44:29PeterBimmbamm (30)csharpWrong answer 3/3028ms22652 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NT20_BimmBammBumm
{
    class Program
    {
        static void vizsgalodas(string[] X, int N, int i = 0, bool hiba = false)
        {
            if ((i+1)%15==0)
                if (X[i]!="BUMM")
                {
                hiba = true;
                }
            if ((i + 1) % 3 == 0)
                if (X[i] != "BIMM")
                {
                    hiba = true;
                }
            if ((i + 1) % 5 == 0)
                if (X[i] != "BAMM")
                {
                    hiba = true;
                }
           if((i+1)%3!=0&&(i+1)%5!=0)
           {
                if (X[i]!="SZAM")
                {
                    hiba = true;
                }
           }

            if (!hiba&&i+1==N)
            {
                Console.WriteLine(0);
            }
            else if (!hiba)
            {
                i++;
                vizsgalodas(X, N, i, hiba);
            }
            else
            {
                Console.WriteLine(i+1);
            }

            return;
        }
        
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] X = new string[N];
            for (int i = 0; i < N; i++)
            {
                X[i] = Console.ReadLine();
            }

            vizsgalodas(X, N);

            Console.ReadKey();

        }
    }
}
SubtaskSumTestVerdictTimeMemory
base3/30
1Accepted0/028ms19896 KiB
2Wrong answer0/027ms20632 KiB
3Wrong answer0/326ms20964 KiB
4Wrong answer0/327ms21272 KiB
5Accepted3/326ms21228 KiB
6Wrong answer0/326ms21628 KiB
7Wrong answer0/325ms22004 KiB
8Wrong answer0/325ms22248 KiB
9Wrong answer0/326ms22332 KiB
10Wrong answer0/326ms22504 KiB
11Wrong answer0/326ms22280 KiB
12Wrong answer0/327ms22652 KiB