Problem - B - Codeforces
Problem - B - Codeforces
pythan | Logout
You have +145! Wow!
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
Your password is extremely weak or has been leaked (see https://haveibeenpwned.com/). Please, change it ASAP.
for (int n = 0; n < N; n++) { // loop over n from 0 to N-1 → Virtual participation
(inclusive)
Virtual contest is a way to take part in past
C[n][0] = 1;
contest, as close as possible to participation
C[n][n] = 1; on time. It is supported only ICPC mode for
for (int k = 1; k < n; k++) // loop over k from 1 to n-1 virtual contests. If you've seen these
problems, a virtual contest is not for you -
(inclusive) solve these problems in the archive. If you
C[n][k] = C[n][k - 1] + C[n - 1][k - 1]; just want to solve some problem from a
contest, a virtual contest is not for you -
}
solve this problem in the archive. Never use
Unfortunately, he made an error, since the right formula is the following: someone else's code, read the tutorials or
communicate with other person during a
virtual contest.
C[n][k] = C[n - 1][k] + C[n - 1][k - 1]
But his team member keblidA is interested in values that were produced using the wrong Start virtual contest
formula. Please help him to calculate these coefficients for t various pairs (ni , ki ). Note that
they should be calculated according to the first (wrong) formula.
→ Clone Contest to Mashup
Since values C[ni ][ki ] may be too large, print them modulo 109 + 7.
You can clone this contest to a mashup.
Input
The first line contains a single integer t (1 ≤ t ≤ 105 ) — the number of pairs. Next, t pairs are Clone Contest
written in two lines.
Example Submit
input Copy
7
2 5 5 100000 100000 100000 100000 → Problem tags
1 2 3 1 33333 66666 99999
Tutorial
https://codeforces.com/contest/2025/problem/B 22/10/24, 1 54 PM
Page 1 of 2
: