Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:AC了,谢以上多位,附正确的加尾数函数In Reply To:WA多次了,真不知序数怎么搞了,已AC的帮忙看看 Posted by:Skyscraper at 2006-07-09 21:28:39 string GetSuffix(int num) { string str ="th"; const static string sufs[3] ={"st", "nd", "rd"}; int ba =num%10; if( ba<=3 && ba >=1 && !(num>=10 && (num/10)%10==1)) { str = sufs[ba-1]; } return str; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator