Sum of K Primes
Submissions: 442   Accuracy:

39.42%

  Difficulty: Easy   Marks: 2

Given two numbers N and K. Find out if ‘N’ can be written as a sum of ‘K’ prime numbers.

Input:
The first line of input contains an integer T denoting the number of test cases. Each test case contains two space separated integers N and K.‚Äč

Output:
Print "1" if N can be expressed as a sum of K primes else print "0".

Constraints:
1<=T<=1000
1<=N,K<=109

Example:
Input:

2
10 2
2 2

Output:
1
0

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Shashwat Jain
Author: shashwat jain


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.