AcWing 869. 试除法求约数
2024-10-08 10:32:53
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> get_divisors(int x) {
vector<int> res;
for (int i = ; i <= x / i; i ++ )
if (x % i == ) {
res.push_back(i);
if (i != x / i) res.push_back(x / i);
}
sort(res.begin(), res.end());
return res;
}
int main() {
int n;
cin >> n;
while (n -- ) {
int x;
cin >> x;
auto res = get_divisors(x);
for (auto x : res) cout << x << ' ';
cout << endl;
}
return ;
}
最新文章
- HttpClient_自定义cookie策略
- c#新语法学习笔记
- 安装vmall5:从ebak恢复数据,需要配置php.ini
- Elasticsearch 5.0
- maven入门程序(3)
- 【转】在Ubuntu上下载、编译和安装Android最新源代码
- BootstrapQ 包Bootstrap tree,dialog等待
- Memcached for windows x64 x32 安装
- Spring源码情操陶冶-AbstractApplicationContext#postProcessBeanFactory
- Android自定义控件系列之应用篇——圆形进度条
- Java小目标
- MySQL分页查询性能优化
- Shell第二篇:正则表达式和文本处理工具
- 学习笔记-AngularJs(九)
- weblogic 乱码
- noip第28课作业
- Codeforces Round #310 (Div. 1) B. Case of Fugitive(set二分)
- jQuery form的load函数与el表达式赋值的冲突问题
- 当本机通过代理服务器上网时,本机无法打开在本机上的虚拟机(oracle vm)linux系统上的网站,但是局域网里的其他机器却可以打开
- 【xsy1378】 水题7号 贪心