Random Teams

TimeLimit:1000MS  MemoryLimit:256MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

图片.png


FJUT突然要居然一个比赛,现在有n个人,他们组成了m个队伍,每个队伍内至少有一个人

每个队伍内的两两可称为朋友,问至少有多少对朋友,至多有多少对朋友

Input

图片.png

单组数据。

输入两个数字,n,m(1 ≤ m ≤ n ≤ 109),代表有多少个人,多少组队伍

Output

图片.png

输出两个数组kmin kmax,代表至少有多少对朋友,至多有多少对朋友

SampleInput 1
5 1
SampleOutput 1
10 10
SampleInput 2
3 2
SampleOutput 2
1 1
SampleInput 3
6 3
SampleOutput 3
3 6
Note

In the first sample all the participants get into one team, so there will be exactly ten pairs of friends.

In the second sample at any possible arrangement one team will always have two participants and the other team will always have one participant. Thus, the number of pairs of friends will always be equal to one.

In the third sample minimum number of newly formed friendships can be achieved if participants were split on teams consisting of 2 people, maximum number can be achieved if participants were split on teams of 1, 1 and 4 people.

Submit
题目统计信息详细
总AC数37
通过人数31
尝试人数36
总提交量100
AC率31.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: