Codeforces Round #603 (Div. 2) C. Everyone is a Winner! (数学)
链接:
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! (数学)的更多相关文章
- 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 ...
- Codeforces Round #603 (Div. 2) C.Everyone is A Winner!
tag里有二分,非常的神奇,我用暴力做的,等下去看看二分的题解 但是那个数组的大小是我瞎开的,但是居然没有问题233 #include <cstdio> #include <cmat ...
- 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 ...
- 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 ...
- Codeforces Round #603 (Div. 2) E. Editor(线段树)
链接: https://codeforces.com/contest/1263/problem/E 题意: The development of a text editor is a hard pro ...
- 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, ...
- 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 ...
- 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 ...
- Codeforces Round #603 (Div. 2) A. Sweet Problem(数学)
链接: https://codeforces.com/contest/1263/problem/A 题意: You have three piles of candies: red, green an ...
随机推荐
- 利用setenv进行tomcat 内存设置
part.1 系统环境及版本 系统环境: centos 7 版本: tomcat 7.0.78 part.2 步骤流程 2.1 新建setenv.sh # cd /usr/local/tomcat/b ...
- 25个强大的CSS代码,据说这些是开发者经常遇到比较棘手的代码
这些代码是经常用到的,比方说一些特殊的效果,圆角边框,CSS透明度,梯形环绕,CSS小三角等,希望对你有用 1简单又好的 Blockquote 样式 CSS代码如下 blockquote { back ...
- 一个刚入行的BIOS工程师的自我简介
现在是北京时间2019年11月28日,大学毕业已经工作四个多月.说来也是奇怪,大学里面明明主修机械电子工程,几乎是纯机械方向,毕业之后的工作却与主修的课程毫无关系.因为对机械这一行业毫无兴趣,大学里面 ...
- Nginx官方文档翻译(转)
add by zhj: 由并发网组织翻译,赞 <Nginx官方文档>WebSocket代理 <Nginx官方文档>配置文件中的单位 <Nginx官方文档>控制ngi ...
- Java学习:线程实现方式
线程实现方式 并发与并行 并发:指两或多个事件在同一个时间段内发生 并行:指两或多个事件在同一个时刻发生(同时发生) 进程的概念 内存:所有的应用程序都需要进入到内存中执行 临时存储RAM 硬盘:永久 ...
- Java的常用API
Object类 1.toString方法在我们直接使用输出语句输出对象的时候,其实通过该对象调用了其toString()方法. 2.equals方法方法摘要:类默认继承了Object类,所以可以使用O ...
- Kafka Streams的Data Types and Serialization
Avro <repositories> <repository> <id>confluent</id> <url>http://packag ...
- 静下心来学jquery的用法
http://blog.csdn.net/xiaojun1288/article/details/6803552
- .NET / C# EF中的基础操作(CRUD)
查 public List<users> Querys() { datatestEntities db = new datatestEntities(); var a = db.users ...
- Javascript PC Emulator
Javascript PC Emulator https://bellard.org/jslinux/ JSLinux Run Linux or other Operating Systems in ...