4162: Diplomas and Certificates

内存限制:256 MB 时间限制:2 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:7 通过:4

题目描述

There are $ n $ students who have taken part in an olympiad. Now it's time to award the students.

Some of them will receive diplomas, some wiil get certificates, and others won't receive anything. Students with diplomas and certificates are called winners. But there are some rules of counting the number of diplomas and certificates. The number of certificates must be exactly $ k $ times greater than the number of diplomas. The number of winners must not be greater than half of the number of all students (i.e. not be greater than half of $ n $ ). It's possible that there are no winners.

You have to identify the maximum possible number of winners, according to these rules. Also for this case you have to calculate the number of students with diplomas, the number of students with certificates and the number of students who are not winners.

有$n$个学生参加过奥林匹克运动会。现在是给学生颁奖的时候了。

他们中的一些人将获得文凭,一些人将获得证书,而另一些人将什么都得不到。有文凭和证书的学生被称为优胜者。但是计算文凭和证书的数量有一些规则。证书的数量必须是文凭数量的$k$倍。中奖人数不得大于所有学生人数的一半(即不大于$ n $的一半)。有可能没有赢家。

你必须根据这些规则找出尽可能多的赢家。同样,在这种情况下,你必须计算有文凭的学生人数,有证书的学生人数和没有获奖的学生人数。

输入格式

The first (and the only) line of input contains two integers $ n $ and $ k $ ( $ 1 \leq n,k \leq 10^{12} $ ), where $ n $ is the number of students and $ k $ is the ratio between the number of certificates and the number of diplomas.

第一行(也是唯一一行)输入包含两个整数$ n $和$ k $ ($ 1\leq n,k \leq 10^{12} $),其中$ n $是学生人数,$ k $是证书数量与文凭数量之间的比率。

输出格式

Output three numbers: the number of students with diplomas, the number of students with certificates and the number of students who are not winners in case when the number of winners is maximum possible.

It's possible that there are no winners.

输出三个数字:有文凭的学生人数,有证书的学生人数,以及在获奖者人数最大的情况下没有获奖的学生人数。

有可能没有赢家。

输入样例 复制

18 2

输出样例 复制

3 6 9

数据范围与提示

样例输入 #1

18 2

样例输出 #1

3 6 9

样例输入 #2

9 10

样例输出 #2

0 0 9

样例输入 #3

1000000000000 5

样例输出 #3

83333333333 416666666665 500000000002

样例输入 #4

1000000000000 499999999999

样例输出 #4

1 499999999999 500000000000