304288: CF818A. Diplomas and Certificates

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Diplomas and Certificates

题意翻译

**题目描述** 有n名学生参加了比赛,现在奖项已经公布了下来。 n名学生中,中有人获得了文凭,也有人获得了证书,但还有人什么都没有。 其中官方颁奖还有个规则: 1.证书的数量必须恰好是文凭数量的k倍。 2.获奖者人数不得超过所有学生人数的一半(即不超过n的一半)。 当然也可能没有赢家。 而题目让你求出最大的赢家数量,以及这种情况下,有文凭的学生人数,有证书的学生人数和没有获奖的学生人数。 **输入格式** 两个整数,n和k,分别是学生人数和证书数量与文凭数量之比。(1<=n,k<=10^12) **输出格式** 三个数,有文凭的学生的数量,有证书的学生的数量和没有中奖的学生的数量。 **提示:可能没有赢家**。

题目描述

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.

输入输出格式

输入格式


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

输出格式


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.

输入输出样例

输入样例 #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

Input

题意翻译

**题目描述** 有n名学生参加了比赛,现在奖项已经公布了下来。 n名学生中,中有人获得了文凭,也有人获得了证书,但还有人什么都没有。 其中官方颁奖还有个规则: 1.证书的数量必须恰好是文凭数量的k倍。 2.获奖者人数不得超过所有学生人数的一半(即不超过n的一半)。 当然也可能没有赢家。 而题目让你求出最大的赢家数量,以及这种情况下,有文凭的学生人数,有证书的学生人数和没有获奖的学生人数。 **输入格式** 两个整数,n和k,分别是学生人数和证书数量与文凭数量之比。(1<=n,k<=10^12) **输出格式** 三个数,有文凭的学生的数量,有证书的学生的数量和没有中奖的学生的数量。 **提示:可能没有赢家**。

加入题单

算法标签: