Statistics

Problem Statement for "Orbitals"

Problem Statement

PROBLEM STATEMENT
In its ground state, an atom has a certain number of electrons in each orbital.
Given the atomic number of an element (ranging from 1 to 112) return a String
representing the orbital configuration.  The orbital configuration is how many
electrons are in each orbital, in increasing energy order, with the orbitals
having the following energy relationship:

1s < 2s < 2p < 3s < 3p < 4s < 3d < 4p < 5s < 4d < 5p < 6s < 4f < 5d < 6p < 7s <
5f < 6d
The orbitals always fill up in order of increasing energy shown above, no
exceptions.

The orbitals can contain up to the following number of electrons each:
s - 2
p - 6
d - 10
f - 14

The return string should be formatted as follows:
"1sA 2sB 2pC 3sD..."
(quotes added for clarity)
Where A={1,2}, B={1,2}, C={1-6}, D={1,2}, and so on.  The String should
terminate at the last orbital with electrons in it.

The arrays of orbital names and corresponding number of electrons are
reproduced here:
orbits =
{"1s","2s","2p","3s","3p","4s","3d","4p","5s","4d","5p","6s","4f","5d","6p","7s"
,"5f","6d"};
electrons = {2,2,6,2,6,2,10,6,2,10,6,2,14,10,6,2,14,10};
These are already in the code window in both java and C++ format for you.

DEFINITION
Class name: Orbitals
Method name: orbitals
Parameters: int
Returns: String
The method signature is:
String orbitals(int element)
Be sure your method is public.

TopCoder will ensure that element is between 1 and 112, inclusive.

EXAMPLES
(quotes added for clarity)
1   - "1s1"
9   - "1s2 2s2 2p5"
18  - "1s2 2s2 2p6 3s2 3p6"
28  - "1s2 2s2 2p6 3s2 3p6 4s2 3d8"
40  - "1s2 2s2 2p6 3s2 3p6 4s2 3d10 4p6 5s2 4d2"
55  - "1s2 2s2 2p6 3s2 3p6 4s2 3d10 4p6 5s2 4d10 5p6 6s1"
111 - "1s2 2s2 2p6 3s2 3p6 4s2 3d10 4p6 5s2 4d10 5p6 6s2 4f14 5d10 6p6 7s2 5f14
6d9"

Definition

Class:
Orbitals
Method:
orbitals
Parameters:
int
Returns:
String
Method signature:
String orbitals(int param0)
(be sure your method is public)

Constraints

    Examples


      This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
      This problem was used for: