Connecting the display screen and signal sources which produce different color signals by cables, then the display screen can show the color of the signal source.Notice that every signal source can only send signals to one display screen each time.
Now you have MM display screens and KK different signal sources(K≤M≤232−1K≤M≤232−1). Select KK display screens from MM display screens, how many cables are needed at least so that **any** KK display screens you select can show exactly KK different colors.
Input
Multiple cases (no more than 100100), for each test case:
there is one line contains two integers MM and KK.
Output
Output the minimum number of cables NN.
Sample Input
3 2 20 15
Sample Output
4 90
Hint
As the picture is shown, when you select M1 and M2, M1 show the color of K1, and M2 show the color of K2. When you select M3 and M2, M2 show the color of K1 and M3 show the color of K2. When you select M1 and M3, M1 show the color of K1.
#include<iostream>
#include<cstdio>
#define ULL unsigned long long
using namespace std;
int main()
{
ULL k,m,ans;
while(~scanf("%lld%lld",&k,&m)){
ans=(k-m+1)*m;
cout<<ans<<endl;
}
return 0;
}