链接:

https://codeforces.com/contest/1263/problem/C

题意:

On the well-known testing system MathForces, a draw of n rating units is arranged. The rating will be distributed according to the following algorithm: if k participants take part in this event, then the n rating is evenly distributed between them and rounded to the nearest lower integer, At the end of the drawing, an unused rating may remain — it is not given to any of the participants.

For example, if n=5 and k=3, then each participant will recieve an 1 rating unit, and also 2 rating units will remain unused. If n=5, and k=6, then none of the participants will increase their rating.

Vasya participates in this rating draw but does not have information on the total number of participants in this event. Therefore, he wants to know what different values of the rating increment are possible to get as a result of this draw and asks you for help.

For example, if n=5, then the answer is equal to the sequence 0,1,2,5. Each of the sequence values (and only them) can be obtained as ⌊n/k⌋ for some positive integer k (where ⌊x⌋ is the value of x rounded down): 0=⌊5/7⌋, 1=⌊5/5⌋, 2=⌊5/2⌋, 5=⌊5/1⌋.

Write a program that, for a given n, finds a sequence of all possible rating increments.

思路:

枚举能得的分, n/sco 是sco对应的人数。再用n/人数,得到当前人数最大的分。

n/(n/num)下取整

代码:

#include<bits/stdc++.h>
using namespace std; int main()
{
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
int sco = 1;
vector<int> res;
res.push_back(0);
while(sco <= n)
{
int num = n/sco;
sco = n/num;
res.push_back(sco);
sco++;
}
cout << (int)res.size() << endl;
for (auto v: res)
cout << v << ' ' ;
cout << endl;
} return 0;
}

Codeforces Round #603 (Div. 2) C. Everyone is a Winner! (数学)的更多相关文章

  1. Codeforces Round #603 (Div. 2) C. Everyone is a Winner! 二分

    C. Everyone is a Winner! On the well-known testing system MathForces, a draw of n rating units is ar ...

  2. Codeforces Round #603 (Div. 2) C.Everyone is A Winner!

    tag里有二分,非常的神奇,我用暴力做的,等下去看看二分的题解 但是那个数组的大小是我瞎开的,但是居然没有问题233 #include <cstdio> #include <cmat ...

  3. Codeforces Round #603 (Div. 2) A. Sweet Problem(水.......没做出来)+C题

    Codeforces Round #603 (Div. 2) A. Sweet Problem A. Sweet Problem time limit per test 1 second memory ...

  4. Codeforces Round #603 (Div. 2) E. Editor 线段树

    E. Editor The development of a text editor is a hard problem. You need to implement an extra module ...

  5. Codeforces Round #603 (Div. 2) E. Editor(线段树)

    链接: https://codeforces.com/contest/1263/problem/E 题意: The development of a text editor is a hard pro ...

  6. Codeforces Round #603 (Div. 2) D. Secret Passwords 并查集

    D. Secret Passwords One unknown hacker wants to get the admin's password of AtForces testing system, ...

  7. Codeforces Round #603 (Div. 2) D. Secret Passwords(并查集)

    链接: https://codeforces.com/contest/1263/problem/D 题意: One unknown hacker wants to get the admin's pa ...

  8. Codeforces Round #603 (Div. 2) B. PIN Codes

    链接: https://codeforces.com/contest/1263/problem/B 题意: A PIN code is a string that consists of exactl ...

  9. Codeforces Round #603 (Div. 2) A. Sweet Problem(数学)

    链接: https://codeforces.com/contest/1263/problem/A 题意: You have three piles of candies: red, green an ...

随机推荐

  1. 如何用Python制作优美且功能强大的数据可视化图像

    第一个案例 首先开始来绘制你的第一个图表 from pyecharts import Bar '''遇到不懂的问题?Python学习交流群:1004391443满足你的需求,资料都已经上传群文件,可以 ...

  2. Grafana邮件报警

    一.概述 报警是Grafana的一项革命性功能,它让Grafana从一个数据可视化工具变成一个真正的任务监控工具.报警规则可以使用现有的图表控制面板设置,阈值可以通过拖拉右边的线控制,非常简单.Gra ...

  3. Java学习:方法重载的使用规则

    方法的重载 对于功能类似的方法来说,因为参数列表不一样,却需要记住那多不同的方法名称,太麻烦. 方法的重载(Overload):多个方法的名称一样,但是参数列表不一样.好处:只需要记住唯一一个方法名称 ...

  4. SQL系列(十)—— 联结(join)

    在数据库设计中,基本上都是根实体ER关系和范式设计多张表.这样更能设计出更合理.紧凑的表结构,提高有效数据存储,数据的管理维护更简便,也提高了库表的伸缩性. 但是事物总是平衡的,在很多场景中单张表的数 ...

  5. 关于暗网需要关闭JS的处理

    最近电视剧导致暗网热度很大,执法力度也大了很多,大部分暗网聚集地都不允许开JS权限访问(原因大家都懂,防止钓鱼执法)​ 因为是英文版而且是火狐,所以简单记录下,以防小白蛋疼 再打开就可以了 Tor协议 ...

  6. CKEditor 4 上传图片

    参考资料:Basic Configuration 直接Ctrl+v(粘贴图片)报错信息:上传文件时发生网络错误(networkError:Network error occurred during f ...

  7. Gearman介绍、原理分析、实践改进

    gearman是什么? 它是分布式的程序调用框架,可完成跨语言的相互调用,适合在后台运行工作任务.最初是2005年perl版本,2008年发布C/C++版本.目前大部分源码都是(Gearmand服务j ...

  8. docker-compose进阶

    笔者在前文<Docker Compose 简介>和<Dcoker Compose 原理>两篇文章中分别介绍了 docker compose 的基本概念以及实现原理.本文我们将继 ...

  9. BUAA-OO-2019 第三单元总结

    JML语言理论基础梳理及工具链 注释结构 JML以javadoc注释的方式来表示规格,每行都以@起头. 行注释://@annotation 块注释:/* @ annotation @*/ JML表达式 ...

  10. 【转载】使用宝塔Linux面板功能查看服务器CPU使用率

    运维过阿里云服务器或者腾讯云服务器的运维人员都知道,针对耗资源以及高并发的应用,很多时候我们需要关注云服务器的资源利用率情况,如最近一段时间内CPU的使用率.内存占用率等情况信息.阿里云和腾讯云官方后 ...