EaglePB2's Competitive Programming Writeups
  • Home Page
  • Why Python?
  • Why 10^9 + 7?
  • General Formatting Title
  • 🇲🇾CodeNection
    • 2021
      • Closed Cateogry
        • Attend Talks
        • Distant Relatives
        • Concert
        • Mamak
        • Fair Contest
      • Open Preliminary Round
        • f(Aibohphobia)^-1
        • Did they cheat?
        • Semester Breaks
      • Open Final Round
        • Ways 1
        • Circular Campus
        • A joke
        • 🥰Last year when life was better
        • Thank You Pizza
    • 2023
      • Test Round
        • Codey and Alphabetical Scoring
        • Codey and Binary Guesser
      • Preliminary Round
        • Codey and CodeNection
        • Codey and Hide-and-Seek
        • Codey and Math
        • Codey and Textbooks
        • Codey and Money
        • Codey and Team Selection
        • Codey and Painted Tree
        • Codey and Number Grid
        • Codey and Crimes
      • Final Round
        • Codey and CodeNection 2
        • Codey and Connection
        • Codey and Schedule
        • Codey and School Supplies
        • Codey and Zombies
        • Codey and Sightseeing
        • Codey and Apples
        • Codey and Facto
        • Codey and Zoey
    • 2024
      • Test Round
        • Codey and Sunday
        • Codey and Takoyaki
      • Preliminary Round
        • Codey and CodeNection
        • Codey and Pebbles
        • Codey and Spam
        • Codey and Coins
        • Codey and Rectangles
        • Codey and Manuscript
        • Codey and Recipes
        • Codey and Toy Kingdom
        • Codey and Peaks
      • Final Round
        • Codey and Exit
        • Codey and Gardening
        • Codey and Symbol
        • Codey and Rectangles 2
        • Codey and Jutsu
        • Codey and Toy Kingdom 2
        • Codey and Speeches
  • ABaKoDa
    • 2023
      • Round 1
        • Problem Letters
        • Problem Statistics
        • Rankings Order
        • Rankings Search
      • Round 2
        • Abakoda Letters
        • Borrowed Words
        • Kensorship
        • Duel Languages
  • Meta Coding Competitions
    • 2011
      • Qualification Round
        • Double Squares
        • Peg Game
        • Studious Student
      • Round 1A
        • Diversity Number
        • Turn on the Lights
        • Wine Tasting
      • Round 1B
        • Chess 2
        • Diminishing Circle
        • Slot Machine Hacker
      • Round 1C
        • N-Factorful
        • Polynomial Factoring
        • Risky Slide
      • Round 2
        • Bonus Assignments
        • Scott's New Trick
        • Studious Student II
      • Final Round
        • Alien Game
        • Party Time
        • Safest Place
  • EaglePB2's Special
    • Hong Kong Identity card
    • Cycle Prefix Averages
    • Word Squares
Powered by GitBook
On this page
  • Question
  • Input Format
  • Constraints
  • Output Format
  • Sample Inputs:
  1. CodeNection
  2. 2023
  3. Final Round

Codey and Zoey

https://www.hackerrank.com/contests/codenection-2023-final-round-open-category/challenges/cn-c18

Question

Codey came to realize that there was something far more profound than simply solving problems, and that was the power of love. On this particular day, Codey decided to go on a date with Zoey.

The two of them found themselves at the origin (0,0)(0,0)(0,0) of a 2D grid, with their romantic destination set at (n,m)(n,m)(n,m) (cell in the n-th row and m-th column). Zoey, a fellow enthusiast for problem-solving, had no intention of making this date a walk in the park. She wanted to put Codey to the test to see if he was truly the one.

So, Zoey asked Codey to find the total number of ways for both of them to reach the destination (n,m)(n,m)(n,m) from the origin (0,0)(0,0)(0,0) while intersecting exactly k times modulo 109+710^9 + 7109+7, all while meeting the following conditions:

  • They both take the shortest path.

  • They move one step at a time.

  • They cannot stop along the way.

Codey is eager to impress Zoey, but once again, it finds itself stuck on this problem. It requires your assistance in finding the number requested by Zoey. Help poor Codey out! Recall that a modulo b is the remainder of a when divided by b.

Input Format

The first line contains three positive integers n, m, k, which represent the destination of Codey and Zoey and the total number of intersections.

Constraints

n,m∈{n,m∣0≤n,m≤50,(n,m)≠(0,0)}n, m \in \{n, m | 0 \le n, m \le 50, (n, m) \ne (0,0)\}n,m∈{n,m∣0≤n,m≤50,(n,m)=(0,0)}
2≤k≤n+m+12 \le k \le n + m+12≤k≤n+m+1

Output Format

Output the total number of ways for both of them to reach the destination (n,m)(n,m)(n,m) from the origin (0,0)(0,0)(0,0) while intersecting exactly k times modulo 109+710^9+7109+7.

Sample Inputs:

Input

2 2 3

Output

12

Explanation

One of the ways for Codey and Zoey to intersect 3 times is shown below:

The 3 intersections in this example are (0,0),(1,1),(2,2)(0,0),(1,1),(2,2)(0,0),(1,1),(2,2)


WIP

PreviousCodey and FactoNext2024

Last updated 5 months ago

🇲🇾