链接:

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. 报错 xxx@1.0.0 dev D:\> webpack-dev-server --inline --progress --configbuild/webpack.dev.conf.js

    是因为node_modules有意外改动,导致依赖库不完整. 解决:1.删除项目下的node_modules,在你的项目目录下 重新执行npm install,这会重新生成node_modules, ...

  2. MyBatis系列(三) MyBatis 配置文件

    一.properties 此标签的主要作用是引用配置文件,以数据源来举例. 新建mybatis-confing.properties配置文件 mybatis-confing.properties dr ...

  3. Xgboost GPU配置

    眼残cmake版本配错了搞了半天,简单记录一下,老规矩,参考一下官方的文档. git clone --recursive https://github.com/dmlc/xgboost cd xgbo ...

  4. Kafka MirrorMaker 跨集群同步工具

    一.MirrorMaker介绍 MirrorMaker是Kafka附带的一个用于在Kafka集群之间制作镜像数据的工具.该工具从源集群中消费并生产到目标群集.这种镜像的常见用例是在另一个数据中心提供副 ...

  5. SQLServer作业调用链接服务器失败解决办法

    新建一个SQL作业,语句手动执行OK,但是作业计划执行总是报错. 消息已以用户 NT SERVICE\SQLSERVERAGENT 的身份执行. 链接服务器 "172.16.10.23&qu ...

  6. DEV 总结

    转自:https://www.cnblogs.com/yuerdongni/archive/2012/09/08/2676753.html 1. 如何解决单击记录整行选中的问题 View->Op ...

  7. APS.NET MVC + EF (01)---Linq和Lambda表达式

    1.1 Linq介绍 LINQ全称 Language Integrated Query(语言集成查询).为我们提供一种统一的方式来查询和操作各种数据. LINQ to Object:是针对实现了IEn ...

  8. jQuery中的DOM操作【续】

    一.复制节点$(选择器字符串).clone(false)    [返回克隆的节点对象]参数:false,浅复制,复制元素但不复制元素中所绑定的事件[默认为false]true,深复制,复制元素且复制元 ...

  9. 全面了解Cookie

    一.Cookie的出现 浏览器和服务器之间的通信少不了HTTP协议,但是因为HTTP协议是无状态的,所以服务器并不知道上一次浏览器做了什么样的操作,这样严重阻碍了交互式Web应用程序的实现. 针对上述 ...

  10. 【数据库】数据库入门(三): SQL

    SQL: 结构化查询语言(Structured Query Language) SQL 是由 IBM 公司首先开发产生,它是关系型数据库最早出现的商用语言之一.1974年,IBM 公司 San Jos ...