C. Everyone is a Winner

[Codeforces]1263C Everyone is a Winner! 题目 On the well-known testing system MathForces, a draw of nnn rating units is arranged. The rating will be distributed according to the following algorithm: if kkk participants take part in this event... 阅读详情

题目读懂了一半 一开始以为是每次/2 样例都没过 果然CF不会那么简单
应该是英语阅读能力不好的原因 没有读出题意
题意是 给一个数n
从i开始枚举 将n/i的数字向下取整保存起来 最后顺序输出
我一开始是直接暴力枚举 在第四个text挂了
面对这种跟约数有关系的 要学会使用 i <= sqrt(n)的优化
然后每次枚举的时候 insert(i和n/i) 可以减少枚举的次数
做完这个优化 就过了

**样例中有0记得加入 还有用set来去重

#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <set>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3f;

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	int t;
	cin >> t;
	while(t--)
	{
		set<int> q;
		q.insert(0);
		int n;
		cin >> n;
		for(int i = 1; i*i <= n; i++)
		{
			q.insert(i);
			q.insert(n/i);
		}
		cout << q.size() << endl;
		for(auto it : q)	cout << it << " ";
		cout << endl;
	}
	return 0;
}

相关推荐

Vmware虚拟机一打开就蓝屏解决方法

Vmware虚拟机一打开就蓝屏解决方法 问题: 一打开Vmware虚拟机就蓝屏,如下图所示: 解决方法1: 启用和关闭windows功能(对话框)——>虚拟机平台(选项打对勾,默认没勾选)——>确定后重启——>再进应该就好了。 解决方法2: ①.查看电脑中的Hyper-V服务是否关闭 1.打开控制面板-程序-程序和功能 2.双击启用或关闭Windows功能 3.把Hyper-V前面的勾去掉 如果后期发下没有反应,或者电脑本身Hyper-V的服务没有打开,可以先打开在关闭,试

m0_55901666的博客 26万+

C. Everyone is a Winner!

题目:C. Everyone is a Winner! 总结:时间有点长935ms。这题我是先是分块。然后对于每一个分块区间再进行操作。需要用个map,防止有重复的插入,因为每重复插入一个耗时就logn。分块区间从后往前操作,使答案的顺序从小到大。 #include <bits/stdc++.h> using namespace std; const int N = 5e5+10; ...

多一些不为什么的坚持 608

SerDes硬件设计原理介绍

接收端:外部差分串行数据------线性均衡器----(CDR从数据中恢复出采样时钟)-----解串器(串行信号转并行信号)-------8B/10B的解码器或解扰器-----FIFO-----FPGA接受差分并行数据。发送端: FPGA发送差分并行数据----FIFO------8B/10B编码器或者扰码器-----串行器(并行信号转串行信号)-----均衡器(滤波)--------TX串行信号差分外发。串行器:8bit的并行数据----2bit的并行数据----1bits的串行数据。

weixin_42304393的博客 1104

codeforces C. Everyone is a Winner!

原题链接:codeforces C. Everyone is a Winner! 题目要求 On the well-known testing system MathForces, a draw of nn rating units is arranged. The rating will be distributed according to the following algorithm: ...

atnanajiang的博客 676

统一大型语言模型和知识图谱:路线图

大型语言模型(LLM),如ChatGPT和GPT4,由于其涌现能力和泛化性,正在自然语言处理和人工智能领域掀起新的浪潮。然而,LLM是黑箱模型,通常无法捕捉和获取事实知识。相反,知识图谱(KGs),例如维基百科和华普,是显式存储丰富事实知识的结构化知识模型。KGs可以通过为推理和可解释性提供外部知识来增强LLM。同时,KGs很难从本质上构建和演化,这对KGs中现有的生成新事实和表示未知知识的方法提出了挑战。因此,将LLM和KGs统一在一起并同时利用它们的优势是相辅相成的。

qq_32907491的博客 2841

测试人必看!正交表与Allpairs工具对比:如何选择最适合你的组合测试方案?

本文深入对比了正交表、PICT与Allpairs三种主流组合测试方案,帮助测试人员根据项目场景做出最佳选择。文章分析了各自的核心原理、优劣势及适用场景,特别强调了在涉及复杂约束时PICT工具的强大功能,并提供了从原理学习到CI/CD集成的实战选型指南。

weixin_29224309的博客 267

Codeforces 1263C Everyone is a Winner!

思路: 1.首先根据素数判定的经验,我们需要将nnn取根号再进行遍历; 2.[n/a]=b[n/a]=b[n/a]=b则有[n/b]=a[n/b]=a[n/b]=a;取了根号我们只需要计算小于等于nnn的值,然后将除的结果作为另一个值就ok了~ 代码: #include<bits/stdc++.h> using namespace std; int main(){ ios::sy...

Yuhan的博客 259

基于boot + 双app升级方案

基于boot+双app的升级方案

weixin_44654285的博客 4514

Everyone is a Winner! CodeForces - 1263C

一、 内容 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,...

Tizzi的博客 748

YOLOv11改进 | 集成FEM、FFM与SCAM即插即用模块:特征增强、融合与空间上下文建模新范式

FEM解决特征表达不足问题,增强关键特征响应FFM优化多尺度融合,提升小目标检测精度SCAM建模空间上下文,改善目标交互预测在保持YOLOv11实时性优势的同时,实现mAP+8.1%的显著提升,特别在复杂光照、密集目标、交互预测场景表现突出。其模块化设计使开发者可根据需求灵活组合,为各种复杂场景提供定制化解决方案。未来,随着跨模态扩展与神经架构搜索的深入,YOLOv11-FSC将进一步推动目标检测技术向更智能、更高效的方向发展。

走向CTO的路上... 988

13《CAN总线五种错误类型,故障判定全解析》

CAN总线规定,发送节点在发送完EOF字段后,会留出一个ACK Slot(应答槽)。这个槽里,发送节点自己会输出隐性电平(逻辑1),然后“期待”至少有一个其他节点在这个槽里把它拉成显性电平(逻辑0)。如果这个槽结束时仍然是隐性电平,发送节点就判定:刚才那帧报文,没有任何一个节点成功接收——这就是应答错误。简单说,就是“我喊了一嗓子,却没人应声”。

2401_88858637的博客 264

【CodeForces 1263C --- Everyone is a Winner!】

【CodeForces 1263C --- Everyone is a Winner!】 Description On the well-known testing system MathForces, a draw of n rating units is arranged. The rating will be distributed according to the following al...

来日浅谈的博客 1107

人工智能算法面试大总结-总目录

涉及秋招、春招、社招

啥都生的博客 2万+

1236C. Everyone is a Winner!

一、Problem 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 ev...

riemann_的博客 468

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

C. Everyone is a Winner!(整除分块)

C. Everyone is a Winner! 题意:给定n,问n的整除答案有多少种并一一输出。(⌊N/i⌋的不同取值个数,输出) 数论分块裸题 如果 ⌊N/i′⌋ 与 ⌊N/i⌋ 相等,那么i‘的最大值为⌊N/⌊N/i⌋⌋ 所以设置两个指针 l 、r。l 初始值为1,每次r=⌊N/⌊N/i⌋⌋,r-l+1就是每种答案的个数,n/r就是每个不同的答案 int a[maxn]; int main(...

手扶拖拉机如何改装四驱 251

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Codeforces 1263C Everyone is a Winner(枚举or数论分块)

Description \quadOn 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 kkk participants take part i...

邵光亮的博客 681

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Everyone is a Winner! CodeForces - 1263C(二分 除法分块)

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 ...

tomjobs的博客 615

Codeforces 1263C. Everyone is a Winner!(整除分块)

传送门 题意: 输入一个数n,求出n/i(i取任意)向下取整有几种数,并输出 思路: 整除分块裸题 for(int l=1,r;l<=n;l=r+1) { r=n/(n/l); a[++cnt]=n/l; } cnt代表分块的块的个数,每个块里的值为a[i]=n/l,l为块的左端点,r为块的右端点r=n/(n/l) 代码: #include <iostream> #i...

_Alexander的博客 310

1263-C Everyone is a Winner! (整除分块)

题目 老实说一开始并不知道这题是整除分块,就打表找规律做出来的。想着当一个数15 先除以15/1 = 15 15 /2=7 15/3=5 15/4=3 15/5=3 15/6=2 15/7=2 15/8=2…可以知道除到前面一定只有一个值,到了后面出现出现重复的后从3开始2 1 都会存在且重复。所以把从重复的数比其小的取完,再把前面分散的大的也取完就可以,因为有剪枝不会T掉。 最开始的代码: #include<iostream> #include<string> #inc

Rikkaの博客 242

C. Everyone is a Winner!---思维

第二天叫醒我的不是闹钟,是梦想! 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 i...

qq_43690454的博客 169

Everyone is a Winner! CodeForces - 1263C(思维水)

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 ...

starlet_kiss的博客 205

codeforces div2 603 C. Everyone is a Winner!(二分)

题目链接:https://codeforces.com/contest/1263/problem/C 题意:给你一个数字n,求n/k有多少个不同的数 思路:首先K大于n时,n/k是0。然后k取值在1到n之间的时候进行二分即可求解。 举个例子,比如n = 11,那么k分别取值1 2 3 4 5 6 7 8 9 10 11时候,n/k是 11 5 3 2 2 1 1 1 1 ...

qq_41949535的博客 263

Codeforces Round #603 (Div. 2)C. Everyone is a Winner!(1263C)题解

C. Everyone is a Winner! 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 ...

sg2021的博客 481
上一篇: KMP入门题集
下一篇: Monsarack‘s Birthday(贪心+阅读)
a simple_boy
博客等级 码龄5年 1粉丝 50原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值