Fişierul intrare/ieşire: | primesums.in, primesums.out | Sursă | IIOT 2021-22 Runda 1 |
Autor | Vlad Andries | Adăugată de | Stefan Dascalescu •stefdascalescu |
Timp execuţie pe test | 0.25 sec | Limită de memorie | 32768 kbytes |
Scorul tău | N/A | Dificultate | N/A |
Vezi solutiile trimise | Statistici
Prime Sums
You are given an integer n and your task is to check how many numbers from 1 to n can be written as sum of k not necessary distinct prime numbers.
As this is too easy, you will have to check whether this is possible or not for q such numbers.
Date de intrare
The input file primesums.in will consist of only one number q, representing the number of queries.
The next q lines will consist of two integers n and k
Date de ieşire
The output file primesums.out will consist of q lines, each having a single element representing the answer of the problem.
Restricţii
- 1 ≤ q ≤ 10^5
- 1 ≤ n ≤ 10^18
- 3 ≤ k ≤ 10^9
- For tests worth 10 points, q = 1, 3 ≤ n, k ≤ 200
- For tests worth 20 more points, q = 1, 1 ≤ n, * k ≤ 10^6
- For tests worth 30 more points, 1 ≤ n ≤ 10^6
Exemplu
primesums.in | primesums.out |
---|---|
4 7 3 10 4 11 5 7 4 | 2 3 2 0 |