hdu1165Eddy's research II

又一道水题,找出规律就行了

#include "iostream"
using namespace std;
int work(int m,int n){
  //cout<<m<<' '<<n<<endl;
  if(m==1)return n+2;
  if(m==2)return 2*n+3;
  if(m==3&&n==1)return 13;
  if(m==3&&n!=1)return 2*work(3,n-1)+3;
}
int main(){
  int m,n;
  while(cin>>m>>n){
    cout<<work(m,n)<<endl;
  }
}

 

 

posted @ 2013-08-25 21:07  龙城星  阅读(142)  评论(0编辑  收藏  举报