J. Unnamed numbers

Codeforces
IDCF10049J
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Vilmantas is a real numberphile. He is fascinated by numbers, but most of all he likes numbers, which are named after famous scientist and mathematicians. For example, there are Mersenne primes (MP = 2p - 1, where _p_ is prime), Graham's number (extremely large number, no way to define it here in commonly known notation). Vilmantas would love to have numbers named after him. This is what he came up with. He takes some positive number and extracts every 2-digit number in the given order. For example, if we extract number 10324, we get a sequence of S = {10, 03, 32, 24}. Then he checks for three conditions: The previous number 10324 breaks two of the conditions: 3 is prime and while GCD(10, 3) = GCD(3, 32) = 1, 32 and 24 are not coprime (GCD(32, 24) = 8). If some number satisfies all three of the conditions, then it is called Vilmantas' number. Given numbers a and b, count the Vilmantas' numbers in range [a;b]. The first line contains the number of test cases _T_ (T ≤ 10). In the following _T_ lines there are integers _a_ and _b_ (1 ≤ a ≤ b ≤ 1011). For each test case output one line containing “_Case #tc: num_”, where _tc_ is the number of the test case (starting from 1) and _num_ is the count of Vilmantas' numbers from a to b inclusive. Only integers coprime to zero are 1 and  - 1. ## Input The first line contains the number of test cases _T_ (T ≤ 10). In the following _T_ lines there are integers _a_ and _b_ (1 ≤ a ≤ b ≤ 1011). ## Output For each test case output one line containing “_Case #tc: num_”, where _tc_ is the number of the test case (starting from 1) and _num_ is the count of Vilmantas' numbers from a to b inclusive. [samples] ## Note Only integers coprime to zero are 1 and  - 1.
**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} $ be the number of dishes. - Let $ A_k = (a_{k,1}, a_{k,2}, \dots, a_{k,N_k}) $ be a sequence of positive integers representing the calorie values of the dishes. - Let $ M_k \in \mathbb{Z} $ be the target total calorie count. - Let $ K_k \in \mathbb{Z} $ be the minimum number of distinct perfect recipes required. **Constraints** 1. $ 1 \le T \le 500 $ 2. For each $ k \in \{1, \dots, T\} $: - $ 1 \le N_k \le 50 $ - $ 1 \le a_{k,i} \le 1000 $ for all $ i \in \{1, \dots, N_k\} $ - $ 1 \le M_k \le 5000 $ - $ 1 \le K_k \le 1000 $ **Objective** For each test case $ k $, let $ R_k $ be the number of distinct subsets $ S \subseteq \{1, \dots, N_k\} $ such that: $$ \sum_{i \in S} a_{k,i} = M_k $$ If $ R_k \ge K_k $, output "ENOUGH". Otherwise, output $ R_k $.
API Response (JSON)
{
  "problem": {
    "name": "J. Unnamed numbers",
    "description": {
      "content": "Vilmantas is a real numberphile. He is fascinated by numbers, but most of all he likes numbers, which are named after famous scientist and mathematicians. For example, there are Mersenne primes (MP = ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10049J"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Vilmantas is a real numberphile. He is fascinated by numbers, but most of all he likes numbers, which are named after famous scientist and mathematicians. For example, there are Mersenne primes (MP = ...",
      "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} $ be the number of dishes.  \n- Let $ A_k = (a_{k,1}...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments