74LS00

Time Limit: 1000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 2812
64-bit integer IO format: %I64d      Java class name: Main

Description

It’s known to us that 74LS00 is a useful digital logic chip for use in a variety of projects. Give you the voltage in all the pins. Your task is quite simple, just estimate whether the chip could work normally or not.
  Here are some essential hints about the pins:

Note: If you chose Pins (1, 2) for input, only Pins (3) would indicate logic.

Here follow the definition of “logic”
If voltage Vi, |Vi-5|<=0.5 then we call it a “High Logic”
If voltage Vi is no larger than 0.8V, and Vi>=0 then we call it a “Low Logic”

“H”: High Logical
“L”: Low Logical
That is to say, if the voltage in Pin 1 is 5.0V and the voltage in Pin 2 is 5.0V, so the Pin 3 indicates Low Logic.
The voltage in Pin 14 must be exactly 5.0V so that the chip could work normally; the voltage in Pin 7 must be always Low Logic.

Input

The input consists of several test cases.
In the first line there is an integer n (2<=n<=10), indicating the number of descriptions.
The next n lines contain the descriptions of the different Pins
All the descriptions are given in the following format
Pin_ID Voltage
We guarantee that the Voltage is always in the range. (0<=Voltage<=0.8 or 4.5<=Voltage<=5.5)
We guarantee that Pin 14 and Pin 7 will always be given in every case.

Output

For each test case, if the chip could work normally, just output “Yes”, else output ”No” (without the quotations)
If the chip could work normally, please output the logic in the “Output Pins” if there exist some.
The format for output the “Output Pins” is:
Pin_ID Logic
Here Logic is either ‘H’ or ‘L’ as it described above.
Hint: You should output the “Output Pins” in ascending&#160;order in Pin_ID.

Sample Input

2
14 5.00000000
7 0.1
2
14 5.1
7 0.8
4
14 5.0000
7 0.7
1 0.3766
2 5.1344
6
14 5.00000000000
7 0
1 5.1
2 5.1
4 5.1
5 5.1

Sample Output

Yes
No
Yes
3 H
Yes
3 L
6 L

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .