链接:

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. How to let your website login with domain account when using IIS to deploy it?

    如何让你的网站以域账号登录 Select your website in IIS Manager, open Authentication, enable Windows Authentication ...

  2. 『异或粽子 堆 可持久化trie』

    异或粽子 Description 小粽是一个喜欢吃粽子的好孩子.今天她在家里自己做起了粽子. 小粽面前有 n 种互不相同的粽子馅儿,小粽将它们摆放为了一排,并从左至右编号为 1 到 n.第 i 种馅儿 ...

  3. 基于 DNS 动态发现方式部署 Etcd 集群

    使用discovery的方式来搭建etcd集群方式有两种:etcd discovery和DNS discovery.在 「基于已有集群动态发现方式部署etcd集群」一文中讲解了etcd discove ...

  4. Python列表(list)所有元素的同一操作

    针对很普遍的每个元素的操作会遍历每个元素进行操作. 这里给出了几种写法,列表每个元素自增等数学操作同理: 示例:整形列表ilist加1个数.元素类型转字符串: ilist = [1, 2, 3, 10 ...

  5. 阿里云服务器连接ftp服务(软件的使用)

    首先你需要有一个阿里云的ECS服务器 开通了宽带之后,ECS服务器就可以上网了 可以在本地电脑cmd控制台运行mstsc.exe启动远程桌面连接 windows+R 计算机名输入ECS服务器的公网ip ...

  6. 一步一步学Spring Boot 2 微服务项目实战 - 黄文毅-2018年8月第一次印刷

    properties 配置文件的优先级高于.yml .在properties文件中配置了server.port=8080 同时在.yml中配置了server.port=8090  Spring Boo ...

  7. pandas-17 关于nan的处理

    pandas-17 关于nan的处理 在pandas中有个另类的存在就是nan,解释是:not a number,不是一个数字,但是它的类型确是一个float类型.numpy中也存在关于nan的方法, ...

  8. 【转载】C#中ArrayList集合类使用RemoveAt方法移除指定索引的元素

    ArrayList集合是C#中的一个非泛型的集合类,是弱数据类型的集合类,可以使用ArrayList集合变量来存储集合元素信息,任何数据类型的变量都可加入到同一个ArrayList集合中,在Array ...

  9. 86.使用webpack爬过的坑

    Webpack 4 和单页应用入门   https://github.com/wallstreetcn/webpack-and-spa-guide

  10. 冬虫夏草winterwormsummerherb英语

    “中药之王”--冬虫夏草WinterwormSummerherb King of Chinese medicine --WinterwormSummerherb “冬天是虫,夏天是草,冬虫夏草是个宝. ...