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

难道不是这样吗?

Posted by 041221125 at 2005-07-30 19:31:37 on Problem 1440
#include<stdio.h>
int f(int n,int m)
{
	if(n<=0)return 0;
	return (n>=m?m:n)+f(n-2*m,m);
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	printf("%d\n",f(n,m));
	return 0;
}


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