oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

pascal Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

pascal.html

Pascal's triangle has the property that every number in the triangle is the sum of the two numbers above it.

          1
        1   1
      1   2   1
    1   3   3   1
  1   4   6   4   1
1   5  10   10  5   1

You are given two integers R and C. Your task is to find the Cth number on the Rth row.

Input

On the first line read in two space-separated integers R and C (1 ≤ C ≤ R ≤ 25).

Output

On the first and only line output the Cth number on the Rth row of Pascal's triangle.

Sample Input 1

5 2

Sample Output 1

4

Tags

Dynamic Programming, Math

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
1100251s32MBAverage
2001s32MBAverage

Judge Compile Command

g++-8 ans.cpp -o pascal -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.