SPOJ NWERC11B Bird tree

题意:根据公式进行分析,当该数字小于1说明往左边走,当数字大于1说明往右边走

#include<stdio.h>
int main()
{
    int T;
    long long a,b,temp;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%lld/%lld",&a,&b);
        while(a!=b)
        {
            if(a>b)
            {
                printf("R");
                temp=b;
                b=a-b;
                a=temp;
            }
            else
            {
                printf("L");
                temp=a;
                a=b-a;
                b=temp;
            }
        }
        printf("\n");

    }
    return 0;
}
原文地址:https://www.cnblogs.com/zsboy/p/2520989.html