BETA
This is a school problem. Successful submissions of this are not counted in user ratings.

Submissions : 940 Accuracy :

24.26

Check if date is valid
     

Given a date, the task is to check if it is valid or not. It may be assumed that the given date is in range from 01/01/1800 to 31/12/9999 and any date not within this range will also be considered invalid.

Examples :

Input : d = 10, m = 12, y = 2000
Output : 1
The given date 10/12/2000 is valid

Input  : d = 30, m = 2, y = 2000
Output : 0
The given date 30/2/2000 is invalid. The
February month cannot have 30 as day.


Input:
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains 3 space separated integers d, m, y denoting the day, month and the year respectively.

Output:
For each test case in a new line print 1 if the date is a valid date else print 0.

Constraints:
1<=T<=100
1<=d, m, y<=10000

Example:
Input:

2
10 12 2000
30 2 2000
Output:
1
0

**For More Examples Use Expected Output**


Set Default Code

					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



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