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

来源:互联网 发布:deepin linux u盘安装 编辑:程序博客网 时间:2024/06/05 18:59

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


#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;}


0 0