【HDU 5640】【水题】King's Cake

  题水的很,就是每次要切的地方都是以小的那个作为边。。。说好的远离水题呢


#include "iostream"
#include "algorithm"
using namespace std;
int main(int argc, char const *argv[])
{
    int t;
    int a,b;
    cin>>t;
    while(t--)
    {
        int num=0;
        cin>>a>>b;
        if(a<b)
            swap(a,b);
        num++;
        while(a-b)
        {
            a-=b;
            if(a<b)
                swap(a,b);
            num++;
        }
        cout<<num<<endl;
    }
    return 0;
}


你可能感兴趣的:(【HDU 5640】【水题】King's Cake)