139522025-01-09 12:51:48250L7Bimmbamm (30)csharpRuntime error 0/3014ms2816 KiB
using System;
/*using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;*/

namespace bimm_bamm_bumm
{
    class Program
    {
        static void Main(string[] args)
        {
            int N;
            N = Convert.ToInt32(Console.ReadLine());
            string[] a = new string[N];
            for (int i = 0; i < N; i++)
            {
                a[i] = Console.ReadLine();
            }
            int e = 0;
            int h = 1;
            while (e == 0)
            {
                if (h % 3 == 0 && (a[h - 1] == "SZAM" || a[h - 1] == "BAMM"))
                {
                    e = h;
                }
                else if (h % 5 == 0 && (a[h - 1] == "SZAM" || a[h - 1] == "BIMM"))
                {
                    e = h;
                }
                else if (h % 3 != 0 && h % 5 != 0 && a[h - 1] != "SZAM")
                {
                    e = h;
                }
                if (h % 3 == 0 && h % 5 == 0 && a[h - 1] == "BUMM")
                {
                    e = h;
                }
                h++;
            }
            h --;
            Console.WriteLine(h);

            //Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/30
1Runtime error0/014ms2780 KiB
2Runtime error0/014ms2764 KiB
3Runtime error0/314ms2744 KiB
4Runtime error0/314ms2768 KiB
5Runtime error0/314ms2712 KiB
6Runtime error0/314ms2776 KiB
7Runtime error0/314ms2816 KiB
8Runtime error0/314ms2768 KiB
9Runtime error0/314ms2768 KiB
10Runtime error0/314ms2652 KiB
11Runtime error0/314ms2768 KiB
12Runtime error0/314ms2756 KiB