hdu2662

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2662

莫名其妙写了一个题,感觉还是很有价值的记录一下。

题目大意:给两个互质的数,求用无限个它们不能组成的最大的数
题目分析:当定理记吧 ans=n*m-n-m

代码:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
#define ll long long

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        ll a,b;
        cin>>a>>b;
        cout<<a*b-a-b<<endl;
    }
    return 0;
}

 

posted @ 2016-12-07 20:42  a_clown_cz  阅读(110)  评论(0)    收藏  举报