Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:AC了,谢以上多位,附正确的加尾数函数

Posted by Skyscraper at 2006-07-25 18:34:34 on Problem 2247
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator