34632023-02-28 11:09:15tothgergelySorozat generáláscsharpTime limit exceeded 16/50377ms26956 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static long general(int m, int a, int b, int x)
        {
            long szam = (long)x * (long)a + (long)b;
            szam %= (long)Math.Pow(10, 3 * m);
            szam /= (long)Math.Pow(10, m);
            return szam;
        }
        static void Main(string[] args)
        {
            int[] szam = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int M = szam[0];
            int X = szam[1];
            int A = szam[2];
            int B = szam[3];
            int N = szam[4];
            int K = szam[5];
            int a;
            int kezd = 0; int veg = 0;
            List<int> l = new List<int>();
            for (int i = 0; i < N; i++)
            {
               X = (int) general(M, A, B, X);
                l.Add(X);
               // Console.WriteLine(X + " ");
                if (l.Contains(X))
                {
                    veg = i;
                }
            }
            kezd = l.IndexOf(X);
            Console.WriteLine(veg - kezd);
            l.Sort();
            Console.WriteLine(l[l.Count - K]);

            
            
            
            
            
            
            
            Console.ReadKey();

        }
    }

}
SubtaskSumTestVerdictTimeMemory
base16/50
1Accepted0/035ms22544 KiB
2Time limit exceeded0/0356ms24592 KiB
3Accepted2/235ms23424 KiB
4Partially correct1/237ms23396 KiB
5Partially correct1/237ms23840 KiB
6Partially correct1/237ms23920 KiB
7Partially correct1/239ms24208 KiB
8Partially correct2/443ms24724 KiB
9Partially correct2/463ms24684 KiB
10Partially correct2/4126ms25584 KiB
11Partially correct2/496ms25992 KiB
12Partially correct2/4123ms26956 KiB
13Time limit exceeded0/4365ms7512 KiB
14Time limit exceeded0/4342ms7528 KiB
15Time limit exceeded0/4349ms8160 KiB
16Time limit exceeded0/4377ms8332 KiB
17Time limit exceeded0/4370ms8460 KiB