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 |
高手看下我写的2229有何问题啊!!#include"stdio.h" long f(int n){ if(n==1)return 1; if(n==2)return 2; if(n%2!=0)return f(n-1); if(n%2==0){ f(n)=f(n-2)+f(n/2); return f(n); } } void main(){ int n; scanf("%d",&n); printf("%d",f(n)); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator