
105  The 8th Zhejiang Provincial Collegiate Programming Contest  A
Ordinal numbers refer to a position in a series. Common ordinals include zeroth, first, second, third, fourth and so on. Ordinals are not often written in words, they are written using digits and letters. An ordinal indicator is a sign adjacent to a numeral denoting that it is an ordinal number, rather than a cardinal number. In English, the suffixes st (e.g. 21st), nd (e.g. 22nd), rd (e.g. 23rd), and th (e.g. 24th) are used. The rules are as follows:
InputThere are multiple test cases. The first line of input is an integer T ≈ 1000 indicating the number of test cases. Each test case consists of a cardinal number 0 ≤ n < 1,000,000,000. OutputFor each test case, output the corresponding ordinal number. Sample Input5 1 2 3 4 1024 Sample Output1st 2nd 3rd 4th 1024th References
Author: Local Contests 2011 Committee Contest: The 8th Zhejiang Provincial Collegiate Programming Contest 