A. Diplomas and Certificates
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Input

The first (and the only) line of input contains two integers n and k (1 ≤ n, k ≤ 1012), where n is the number of students and k is the ratio between the number of certificates and the number of diplomas.

Output

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.

Examples
Input
18 2
Output
3 6 9
Input
9 10
Output
0 0 9
Input
1000000000000 5
Output
83333333333 416666666665 500000000002
Input
1000000000000 499999999999
Output
1 499999999999 500000000000

A题是个数轮,要用数学方法找出这三个数,或者根据答案找通项公式也行?

#include <stdio.h>
typedef long long LL;
int main(){
LL n,k;
scanf("%lld%lld",&n,&k);
LL a=n//(k+);
LL b=k*a;
printf("%lld %lld %lld",a,b,n-a-b);
return ;}

Educational Codeforces Round 24的更多相关文章

  1. Educational Codeforces Round 24 A 水 B stl C 暴力 D stl模拟 E 二分

    A. Diplomas and Certificates time limit per test 1 second memory limit per test 256 megabytes input ...

  2. Educational Codeforces Round 24 CF 818 A-G 补题

    6月快要结束了 期末也过去大半了 马上就是大三狗了 取消了小学期后20周的学期真心长, 看着各种北方的学校都放假嗨皮了,我们这个在北回归线的学校,还在忍受酷暑. 过年的时候下定决心要拿块ACM的牌子, ...

  3. Educational Codeforces Round 24 E

    Vova again tries to play some computer card game. The rules of deck creation in this game are simple ...

  4. codeforces Educational Codeforces Round 24 (A~F)

    题目链接:http://codeforces.com/contest/818 A. Diplomas and Certificates 题解:水题 #include <iostream> ...

  5. Educational Codeforces Round 24 D

    Alice and Bob got very bored during a long car trip so they decided to play a game. From the window ...

  6. Educational Codeforces Round 24 B

    n children are standing in a circle and playing a game. Children's numbers in clockwise order form a ...

  7. Educational Codeforces Round 24 A

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

  8. Educational Codeforces Round 24 题解

    A: 考你会不会除法 //By SiriusRen #include <bits/stdc++.h> using namespace std; #define int long long ...

  9. Educational Codeforces Round 32

    http://codeforces.com/contest/888 A Local Extrema[水] [题意]:计算极值点个数 [分析]:除了第一个最后一个外,遇到极值点ans++,包括极大和极小 ...

随机推荐

  1. C#入门笔记2 变量

    变量关系到数据的存储,一个供程序操作的存储区的名字,每一个变量都一个特定的类型,类型决定变量的内存大小和布局. 注:必须一定要先声明,赋值后,才能使用. 变量声明 三种声明方式: 1.先声明,后赋值. ...

  2. 关于React的赋值与调用方法

    #关于React的赋值与调用方法 比如调用方法的时候我们可以这样来使用closeFrm() <div className = "infoFrm_close" onMouseO ...

  3. Android - CollapsingToolbarLayout 完全解析

    CollapsingToolbarLayout 是 google 在其推出的design libiary 中给出的一个新型控件.其可以实现的效果类似于: toolbar是透明的,有一个背景图片以及大标 ...

  4. COGS 264. 数列操作

    时间限制:1 s   内存限制:160 MB [问题描述] 假设有一列数 {Ai }(1 ≤ i ≤ n) ,支持如下两种操作: (1)将 A k 的值加 D .( k, D 是输入的数) (2) 输 ...

  5. MINST手写数字识别(一)—— 全连接网络

    这是一个简单快速入门教程——用Keras搭建神经网络实现手写数字识别,它大部分基于Keras的源代码示例 minst_mlp.py. 1.安装依赖库 首先,你需要安装最近版本的Python,再加上一些 ...

  6. 通过例子理解 k8s 架构【转】

    为了帮助大家更好地理解 Kubernetes 架构,我们部署一个应用来演示各个组件之间是如何协作的. 执行命令 kubectl run httpd-app --image=httpd --replic ...

  7. Encryption-基础:MD5加密

    环境:vc2003 .h /* MD5.H - header file for MD5C.C */ /* Copyright (C) 1991-2, RSA Data Security, Inc. C ...

  8. windows 使用git上传代码至github

    1. 首先创建github账户 2. 创建github项目 3.  windows安装git工具 ·下载地址:https://git-for-windows.github.io/ ,下载直接安装即可, ...

  9. 【chm】【windows】win7下chm打开不显示内容

    修改chm属性里面,‘解除锁定’即可.点击chm文件,右键选择属性,点击最下方的解除锁定,保存,退出重新打开即可. ​

  10. [php] 高级教程

    include 和 require 语句用于在执行流中插入写在其他文件中的有用的代码. include 和 require 除了处理错误的方式不同之外,在其他方面都是相同的: require 生成一个 ...