Пример #1
0
        public static void Main(String[] args)
        {
            mymath m = new mymath(MyClass.fact);

            m(5);
            m = MyClass.sqr;
            m(6);

            m = MyClass.cube;
            m(7);

            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            mymath ref1 = new mymath(math.square);

            Console.WriteLine(ref1(5));

            mymath ref2 = new mymath(math.cube);

            Console.WriteLine(ref2(5));

            mymath ref3 = new mymath(math.factorial);

            Console.WriteLine(ref3(2));
        }
Пример #3
0
        static void Main(string[] args)
        {
            math   obj = new math();
            mymath ref1;

            ref1 = new mymath(obj.square);
            Console.WriteLine(ref1(5));

            ref1 = new mymath(obj.cube);
            Console.WriteLine(ref1(5));

            ref1 = new mymath(obj.factorial);
            Console.WriteLine(ref1(5));
        }
Пример #4
0
    static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput())
        {
            AutoFlush = false
        };
        var  sc = new Scan();
        var  mt = new mymath();
        var  inp = sc.LongArr;
        long a = inp[0], b = inp[1];
        int  m   = (int)inp[2];
        long g   = mt.gcd(a, b);
        var  ini = new long[] { 1, 1 };

        sw.WriteLine(mt.mulmat(mt.powmat(new long[][] { new long[] { 10, 1 }, new long[] { 0, 1 } }, a - 1, m), ini, m)[0] * mt.mulmat(mt.powmat(new long[][] { new long[] { mt.powmod(10, g, m), 1 }, new long[] { 0, 1 } }, b / g - 1, m), ini, m)[0] % m);
        sw.Flush();
    }
Пример #5
0
    static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput())
        {
            AutoFlush = false
        };
        var sc = new Scan();
        int n, a, b;

        sc.Multi(out n, out a, out b);
        var inp = sc.LongArr;

        Array.Sort(inp);
        var ar = copy(inp);

        if (a == 1)
        {
            foreach (var item in ar)
            {
                sw.WriteLine(item);
            }
            sw.Flush();
            return;
        }
        int c = 0;

        for (int i = 0; i < n; i++)
        {
            while (ar[i] * a <= ar[n - 1])
            {
                ar[i] *= a;
                ++c;
            }
        }
        Array.Sort(ar);
        if (c > b)
        {
            ar = copy(inp);
            for (int i = 0; i < b; i++)
            {
                ar[0] *= a;
                Array.Sort(ar);
            }
            foreach (var item in ar)
            {
                sw.WriteLine(item);
            }
            sw.Flush();
            return;
        }
        b -= c;
        int ba = b / n, bb = b % n;
        var arr = new long[n];
        var mt  = new mymath();

        for (int i = 0; i < n - bb; i++)
        {
            arr[i] = ar[i + bb] * mt.powmod(a, ba, M) % M;
        }
        for (int i = n - bb; i < n; i++)
        {
            arr[i] = ar[i + bb - n] * mt.powmod(a, ba + 1, M) % M;
        }
        foreach (var item in arr)
        {
            sw.WriteLine(item);
        }
        sw.Flush();
    }