eolymp
bolt
Try our new interface for solving problems
Problems

Cabin Baggage

Cabin Baggage

Cabin baggage (also called carry on or hand baggage) is a bag that a passenger is allowed to bring into an aircraft. For safety purpose, cabin baggage must not be too heavy or too big. Every airline company can set its own size and weight limits of cabin baggage according to the IATA (International Air Transport Association) guidelines. \textit{ICPC airline} has set the cabin baggage limits as follows: Cabin baggage should have a maximum length of 56 cm, width of \textbf{45} cm and depth of \textbf{25} cm or the sum of all \textbf{3}sides (length+width+depth) should not exceed \textbf{125} cm. Its weight must not exceed \textbf{7} kg. \includegraphics{https://static.e-olymp.com/content/d8/d8b130b1a58908b1b39243ceb81b07f02137f521.jpg} The company has a laser measurement device with high precision to evaluate the size and weight of cabin baggage. The device gives \textbf{4} values which are positive numbers with \textbf{2} decimal points. They are length, width, depth (in cm) and weight (in kg), respectively. For example, \textbf{51.23 40.12 21.20 3.45} (this bag is allowed) \textbf{60.00 30.00 20.00 7.00} (this bag is allowed) \textbf{52.03 41.25 23.50 7.01} (this bag is not allowed) You task is to write a program to check whether or not a cabin baggage is allowed. \InputFile The first line contains an integer \textbf{t} (\textbf{1} ≤ \textbf{t} ≤ \textbf{300}) which determines the number of test cases (i.e. cabin baggage to verify). The following \textbf{t} lines contain the measurement of cabin baggage. Each line contains \textbf{4} values which are length, width, depth and weight, respectively. All these \textbf{4} values are positive numbers with \textbf{2} decimal points. \OutputFile For each test case, print out in a line, \textbf{1} if it is allowed or \textbf{0} otherwise. Finally, print out the total number of the allowed bags in the last line.
Time limit 1 second
Memory limit 128 MiB
Input example #1
4
51.23 40.12 21.20 3.45
60.00 30.00 20.00 7.00
52.03 41.25 23.50 7.01
50.00 45.00 30.10 6.02
Output example #1
1
1
0
0
2
Author Seksun Suwanmanee
Source ACM-ICPC Asia Phuket Regional Programming Contest 2013, 22 November 2013