D. Popcorn

Codeforces
IDCF10114D
Time2000ms
Memory64MB
Difficulty
English · Original
Formal · Original
Maram and Marwa are an example of good friends. They know each other since they were in the kindergarten. One day, they went together to the movies after they bought two tickets for the famous movie "Avatar". Since the movie is very exciting, the girls decided to get some Popcorn so they can enjoy the movie as much as possible. Unfortunately, There was only one packet left at the Popcorn corner at the theater. So Maram immediately ran and bought the packet before Marwa! When the movie began, Maram started eating the Popcorn while Marwa sat and watched the movie sadly. So Maram decided to give Marwa some of her Popcorn. To be exact, she decided to give Marwa an amount of Popcorn as much as Marwa can carry in one hand. Marwa knows that she can carry only M pieces in her hand, she is wondering, in how many ways can she pick the Popcorn pieces (all Popcorn pieces are unique). Can you help her? The first line of the input contains T the number of the test cases. Each test is represented with two integers on a single line. ( 0 < N ≤ 20 ) the number of the Popcorn pieces in the packet, ( 0 < M ≤ N ) the number of pieces Marwa can carry in one hand. For each test case print one line, the answer to Marwa's question. ## Input The first line of the input contains T the number of the test cases. Each test is represented with two integers on a single line. ( 0 < N ≤ 20 ) the number of the Popcorn pieces in the packet, ( 0 < M ≤ N ) the number of pieces Marwa can carry in one hand. ## Output For each test case print one line, the answer to Marwa's question. [samples]
**Definitions** Let $ T \in \mathbb{Z} $ be the number of test cases. For each test case $ k \in \{1, \dots, T\} $: - Let $ N_k \in \mathbb{Z} $ denote the number of unique popcorn pieces. - Let $ M_k \in \mathbb{Z} $ denote the number of pieces Marwa can carry in one hand. **Constraints** 1. $ 1 \leq T \leq \text{unknown upper bound} $ 2. For each $ k \in \{1, \dots, T\} $: - $ 0 < N_k \leq 20 $ - $ 0 < M_k \leq N_k $ **Objective** For each test case $ k $, compute the number of ways to choose $ M_k $ distinct pieces from $ N_k $ unique pieces: $$ \binom{N_k}{M_k} $$
API Response (JSON)
{
  "problem": {
    "name": "D. Popcorn",
    "description": {
      "content": "Maram and Marwa are an example of good friends. They know each other since they were in the kindergarten. One day, they went together to the movies after they bought two tickets for the famous movie \"",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 65536
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10114D"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Maram and Marwa are an example of good friends. They know each other since they were in the kindergarten. One day, they went together to the movies after they bought two tickets for the famous movie \"...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ k \\in \\{1, \\dots, T\\} $:  \n- Let $ N_k \\in \\mathbb{Z} $ denote the number of unique popcorn pieces.  \n- L...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments