这道题就一个公式:
定理:给定两个互素的正整数和,那么它们最大不能组合的数为,不能组合的数的个数为
至于原理,好像要用到什么不知名的玩意去证明,等下次吧~~~
附上代码:
#include <iostream>
using namespace std;
int main()
{
int a,b;
while(cin>>a>>b)
{
cout<<a*b-a-b<<" ";
cout<<(a-1)*(b-1)/2<<endl;
}
return 0;
}