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 |
此题代码很短,,请各位看一下我在 调用函数f ( ) 中调用 函数min ( ) 能否这样写。。。#include"stdio.h" long f(long ); long min(long ,long ,long ); long m,n; void main() { scanf("%ld%ld",&m,&n); printf("%ld",f(m)); getch(); } long f(long m) { if(m>=n) return (m-n); return (min(1+f(m+1),1+f(m-1),1+f(2*m))); } long min(long a,long b,long c) { long min; min=a; if(b<min) min=b; if(c<min) min=c; return min; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator