poj 2756 二叉树

#include <iostream>
using namespace std;

int common(int x,int y)
{
    if (x==y)
        return x;
    if (x>y)
        return common(x/2,y);
    else
        return common(x,y/2);
}

int main()
{
    int x,y;
    cin>>x>>y;
    cout<<common(x,y)<<endl;

    return 0;
}

posted @ 2012-04-11 20:24  逝者*恋世  阅读(112)  评论(0编辑  收藏  举报