ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1083. Factorials!!!

Accepted C#
Posted by AKdeBerg 27 Apr 2018 10:50
using System;

namespace Timus1083
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' '); //taking input

            int n = int.Parse(input[0]); // taking the value of n from string and convert it to int
            int k = input[1].Length; //taking the value of k where k means the number of !

            //main method to calculate the factorial
            int fact = 1, i = 0, mul = 1;

            while (mul >= 1)
            {

                 fact *= mul;
                 mul = n - (i * k);
                 i++;
            }
            System.Console.WriteLine(fact);
        }
    }
}