/*
给定两个互质的数,a,b,求这两个数不能表示的数的最大值和个数。
最大值=a*b-a-b;
个数 =(a-1)*(b-1)/2;
*/
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long LL;
using namespace std;
int n,m;
int main ()
{
while(~scanf("%d%d",&n,&m))
{
printf("%d %d\n",n*m-n-m,(n-1)*(m-1)/2);
}
return 0;
}
A New Change Problem
最新推荐文章于 2025-06-20 22:19:24 发布
本文介绍了一种快速求解由两个互质数构成的所有不可表示数值的最大值及数量的方法。核心公式为最大值=a*b-a-b,数量=(a-1)*(b-1)/2。
115

被折叠的 条评论
为什么被折叠?



