Timer is Running

Reverse Coding
Submissions: 7383   Accuracy:


  Difficulty: Easy   Marks: 2

Sherlock Being tired with the usual coding rounds started growing his interest towards reverse coding when he won the event in his college symposium. He wondered if his friend has the brain to quickly identify the pattern and verify if his inputs are correct or not. From the example portion given below, where you will be given a number(n) and its output, Using this find the pattern. Your task is that from the pattern you identified above, You have to tell if for the given n whether the given m is the correct answer or not...

The first line consists of T, the number of test cases. then T lines follow. Each line consists of n and m.

For each n and m output 1 if m is the corresponsing input for the value of n and 0 otherwise.

1 <= t <= 50
0 <= n <= 1000
0 <= m <= 106

Example to identify the pattern :
Input                            Output
10                                 55
20                                 210
5                                   15
0                                    0
1                                    1
2                                    3

10 55
4 11
2  3
6 21

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

Contributor: Vikraman
Author: vikikkdi

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.