当前位置:网站首页>Group programming ladder race - exercise set l1-006 continuity factor
Group programming ladder race - exercise set l1-006 continuity factor
2022-07-04 07:58:00 【Cod_ ing】
characteristic : Slightly improved the comrade's code
#include<iostream>
#include<vector>
#include<cmath>
typedef long long ll;
using namespace std;
int main() {
int n;
vector<int> ans;
vector<int> temp_;
cin >> n;
int lim = sqrt(n); // The factor of the input number will not exceed its root
for (int i = 2; i <= lim; i++) {
ll temp = 1;
for (int j = 0; j < 12; j++) {
//13 The factorial of exceeds int The maximum of (2^31), Therefore, the maximum length will not exceed 12
temp *= (i + j);
if (temp > n)
break;
if (n % temp == 0) {
temp_.push_back(i + j);
}
else
break;
}
if (temp_.size() > ans.size()) {
ans.assign(temp_.begin(), temp_.end());
}
temp_.clear();
}
if (ans.empty()) {
// Special judgment prevents segment transcendence
cout << 1 << endl << n;
return 0;
}
cout << ans.size() << endl;
if (ans.size() == 1)
cout << ans[0];
else {
for (int i = 0; i < ans.size() - 1; i++)
cout << ans[i] << "*";
cout << ans[ans.size() - 1];
}
return 0;
}
边栏推荐
- L1-030 one gang one (15 points)
- 1、卡尔曼滤波-最佳的线性滤波器
- Take you to master the formatter of visual studio code
- [real case] how to deal with the failure of message consumption?
- zabbix监控系统自定义监控内容
- Advanced MySQL: Basics (5-8 Lectures)
- How to set multiple selecteditems on a list box- c#
- MYCAT middleware installation and use
- BUUCTF(3)
- Add log file to slim frame - PHP
猜你喜欢
谷歌官方回应:我们没有放弃TensorFlow,未来与JAX并肩发展
Unity opens the explorer from the inspector interface, selects and records the file path
Oracle-存储过程与函数
zabbix 5.0监控客户端
The frost peel off the purple dragon scale, and the xiariba people will talk about database SQL optimization and the principle of indexing (primary / secondary / clustered / non clustered)
Used on windows Bat file startup project
墨者学院-PHPMailer远程命令执行漏洞溯源
Amd RX 7000 Series graphics card product line exposure: two generations of core and process mix and match
Blog stop statement
神经网络入门(下)
随机推荐
Wechat has new functions, and the test is started again
zabbix 5.0监控客户端
zabbix监控系统部署
Detailed introduction to the big changes of Xcode 14
Life planning (flag)
yolov5 xml数据集转换为VOC数据集
How to use C language code to realize the addition and subtraction of complex numbers and output structure
Div hidden in IE 67 shows blank problem IE 8 is normal
【Go基础】2 - Go基本语句
运动【跑步 01】一个程序员的半马挑战:跑前准备+跑中调整+跑后恢复(经验分享)
I was pressed for the draft, so let's talk about how long links can be as efficient as short links in the development of mobile terminals
In the era of low code development, is it still needed?
Oracle-存储过程与函数
[performance test] read JMeter
Sports [running 01] a programmer's half horse challenge: preparation before running + adjustment during running + recovery after running (experience sharing)
Flask 常用组件
Parallel shift does not provide any acceleration - C #
【性能測試】一文讀懂Jmeter
神经网络入门(下)
How to use MOS tube to realize the anti reverse connection circuit of power supply