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;
}

从零到英雄:WSL2与Ubuntu22.04的终极性能调优指南 本文详细介绍了如何在Windows系统中通过WSL2与Ubuntu22.04进行性能调优,涵盖内核定制、GPU加速、网络优化等关键技巧,帮助开发者打造媲美原生Linux的高性能开发环境,特别适合AI训练和大数据处理等资源密集型任务。 阅读详情

相关推荐

TensorRT(C++)部署 Pytorch模型

众所周知,python训练pytorch模型得到.pt模型。但在实际项目应用中,特别是嵌入式端部署时,受限于语言、硬件算力等因素,往往需要优化部署,而tensorRT是最常用的一种方式。本文以yolov5的部署为例,说明模型部署在x86架构上的电脑端的流程。(部署在Arm架构的嵌入式端的流程类似)。

女神sha手的博客 5419

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

多一些不为什么的坚持 610

MTK Linux Charger驱动分析(二) - power_supply_core.c

的核心作用可以概括为:提供统一的电源管理框架;管理电源设备注册、属性访问、事件通知;封装sysfs 接口和 uevent 通知,屏蔽硬件细节;驱动开发者只需要实现,不关心底层通知和接口细节。简单来说,它是电源子系统的“大脑和中枢”,具体的电池/充电器只是“信息源”。

iTom1900 1494

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

DDPG算法实战:用Python一步步实现深度强化学习中的连续动作控制

本文详细介绍了DDPG算法在深度强化学习中的连续动作控制应用,通过Python和PyTorch实现从零构建智能体。内容涵盖环境搭建、网络架构设计、经验回放、OU噪声实现及训练流程优化,帮助开发者掌握DDPG在机械臂控制等场景的核心技术。

weixin_30335575的博客 421

低功耗和UPF介绍

参考[UPF]低功耗(Low Power Design)and UPF介紹

青春易逝,愿不负昭华,期待梦与远方 1万+

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

嵌入式STM32控制电梯面板

嵌入式STM32控制电梯面板 用点阵来显示电梯向上还是向下运动,用数码管来显示楼层数(由于灯阵显示楼层数比较困难故用数码管代替)。当按下对应的按钮,就可以去到对应层数,可上升可下降。 #include "stm32f10x.h" #include "stm32f10x_exti.h" #include "stm32f10x_it.h" #define uint unsigned int #define KEY1 GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_10) #define

code_init_的博客 2115

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的博客 750

修改注册表导致开机时电脑显示“无法登陆到你的账户”的问题解决方案

1.问题描述:开机电脑显示“无法登陆到你的账户:通常可以通过从你的账户注销,然后重新登陆来解决问题,如果不立即注销,你创建的任何文件或进行的任何更改都将会丢失。” 2.问题原因:想要修改cmd中的用户名(红色部分),修改了注册表,重启时出现问题。 3.问题解决: win+R输入cmd,确定进入注册表界面,将下面的地址复制进地址栏(你也可以自己按目录查找),双击ProfileImage...

qq_33835957的博客 7万+

Linux系统安装部署Redis完整教程(图文详解)

最近需要在Linux服务器安装部署Redis,参考了网上很多的文章,比较零碎,所以我自己写了一篇完整的Redis安装部署文档,在部署Redis之前重装了我的华为服务器,就是为了给大家一步步阐述我的操作过程,配合图文进行讲解更加通俗易懂!

黄团团的个人博客 6697

【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

Autosar NvM配置-手动配置Nvblock及使用-基于ETAS软件

NVM作为存储协议栈中最顶层的模块,是必须要掌握的。目前项目基本使用MCU带的Dflash模块,使用Fee模拟eeprom。在项目前期阶段,应该充分讨论需要存储的内容,包括应用数据,诊断数据等,用以评估Dflash空间是否够用。本文基于ETAS软件介绍NVBlock配置生成NVM参数及使用。使用NVBlock配置生成,基本不用手写代码,还是比较方便的。对于Nv block的划分,建议将同时写的一类数据放到一个block中,因为block除了data以外,Fee还会增加一些header数据,占用不少内存。

赞的博客 1895

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_的博客 469

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

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

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

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

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

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

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的博客 616

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的博客 170

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、付费专栏及课程。

余额充值