Problem 1: Quantum Numbers
Background
In Quantum Mechanics, a set of four numbers are often
used to describe an electron of an atom. The first
three of these numbers are integers (they must
be integers btw. I won't bore you with the
mathematics to show you why though) They are labeled
n, l, m in that order. They are subject to the following
restrictions:
- n: Integer values such that n is greater than or
equal to one (n >= 1).
- l: Integer values such that zero is less than or equal
to l and l is less than or equal to n
minus one. (0 <= l <= n - 1).
- m: Integer values such that m is between
minus l and positive l. (-l <= m <= l)
Your job is to write a program to tell if 3 integers represent
a valid quantum set.
Input
Each line of input will be 3 number in the form n l m.
A single space separates each number.
Output
For each line of input you must tell if it is a valid set of
quantum number or not. If it is an invalid set, then you must
say why. The output will be one of the following:
invalid n
invalid l
invalid m
valid
Only print one line of output. The input set could
be invalid for a number of reasons. Your program should only
print the first one. Check for n, then l, and
finally m.
Sample Input
-1 2 3
3 3 4
2 1 -1
3 2 -4
Sample Output
invalid n
invalid l
valid
invalid m