继续整理公式:
若A,B为两个互质整数,那么A,B最大不能组合的数为A*B-A-B;
不能组合的数的个数为:
(A−1)∗(B−1)2
Orz…大佬们牛
知道了公式水题。。。
code:
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<iostream>
#include<string>
#include <set>
#include<time.h>
using namespace std;
#define ll long long
#define mem(a) memset(a,0,sizeof(a))
const double eps=1e-8;
const int maxn=30010;//须填写
const int inf=0x3f3f3f3f;
int main()
{
ll a,b;
while(cin>>a>>b)
{
cout<<a*b-a-b<<" "<<(a-1)*(b-1)/2<<endl;
}
return 0;
}