Educational Codeforces Round 24
1 second
256 megabytes
standard input
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.
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 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
9 10
0 0 9
1000000000000 5
83333333333 416666666665 500000000002
1000000000000 499999999999
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 ;}
最新文章
- [Python] Python中的一些特殊函数
- Nodejs电影建站开发实例(下)
- C#代码:用事件模式实现通知
- Inlinehook PspCreateProcess
- JDBC 基础概念
- css案例学习之层叠样式
- MFC消息响应机制分析
- Web地图呈现原理
- Lombok插件看法浅谈
- SQLServer数据库分页
- 雷林鹏分享:jQuery EasyUI 树形菜单 - 树形菜单加载父/子节点
- centos 安装 composer
- XXS level5
- tkinter pyqt同时呈现两个窗口
- Pycharm快捷键整理(Mac)
- Git 清除远端已删除的分支
- Linux时间子系统(十二) periodic tick
- 查看linux上面是否有安装redis
- HDU 4747(AC不能)
- BZOJ5091 摘苹果(概率期望)
热门文章
- 死磕 java并发包之AtomicStampedReference源码分析(ABA问题详解)
- 浅谈Hibernate中的三种数据状态
- hdu6118 度度熊的交易计划
- sqlserver 视图用 case when
- [论文笔记] A Practical Architecture of Cloudification of Legacy Applications (2011, SERVICES)
- codevs 1553 互斥的数
- UIButton zoomin pressed
- vector的基本用法
- 团队作业-Beta冲刺第三天
- a标签目标链接问题