摘要:
//递归-放苹果#includeint count(int x,int y){ if(y==1||x==0) return 1; if(x<y) return count(x,x); return count(x,y-1)+count(x-y,y);}int main(){ int t,m,n,... 阅读全文
摘要:
//逆波兰表达式#include#includedouble exp(){ char a[10]; scanf("%s",a); switch(a[0]) { case '+':return exp()+exp(); case '-':return exp()-exp(); case '/... 阅读全文
摘要:
//二叉树#includeint common(int x,int y){ if(x==y) return x; if(x>y) common(x/2,y); else common(x,y/2);}int main(){ int m,n; scanf("%d%d",&m,&n); printf... 阅读全文
摘要:
//菲波那契数列#includeint f(int a){ if(a==1||a==2) return 1; else return f(a-1)+f(a-2);}int main(){ int n; scanf("%d",&n); for(int i=0;i<=n;i++) { int... 阅读全文
摘要:
//优化判断条件的例子:讨厌的青蛙#include#includeint r,c,n;struct PLANT{ int x,y;};PLANT plants[5001];PLANT plant;int myCompare(const void *ele1,const void *ele2);i... 阅读全文