77 - The 9th Zhejiang University Programming Contest - C
Kaspersky Anti-Virus (often referred to as KAV) is an antivirus program developed by Kaspersky Lab. One of its operations is scan. When running scan, there are two kinds of information in the window: the number of files scanned and the percentage of files been processed, which are demonstrated in the figure below. As we can see, the percentage presented is always an integer in [0, 100]. What's more, we have no idea the number of files in total, which is a positive integer. If a list of (number, percent) pairs has been recorded, can we decide whether truncation or rounding KAV may use to calculate the percentage? Both truncation and rounding first discard the digits after the decimal point. Then, rounding increases the percentage by 1 if the digit immediately after the decimal point is 5 or more.
The first line of the input contains an integer T (T <= 200), indicating the number of cases.
Each case starts with the number of records n (1 <= n <= 1000) in a line, followed by n lines in the format m p% (1 <= m <= 10000, 0 <= p <= 100), where m is the number of files scanned and p is the corresponding percentage. Both m and p are integers.
Cases are separated by one blank line.
For each case, if it can only be produced by rounding, print "Rounding" in a single line. If it can only be produced by truncation, print "Truncation" in a single line. If it can be produced by either rounding or truncation, print "Either". If neither mechanism can produce the records (due to mistakes made in recording), print "Neither" instead.
4 2 1 1% 2 1% 2 1 1% 3 5% 1 1 1% 2 1 2% 2 1%
Rounding Truncation Either Neither
Author: GAO, Yuan
Contest: The 9th Zhejiang University Programming Contest