当前位置:网站首页>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;
}
边栏推荐
- [go basics] 1 - go go
- What determines vacuum permittivity and vacuum permeability? Why do these two physical quantities exist?
- Easy to understand: understand the time series database incluxdb
- 大学阶段总结
- Wechat has new functions, and the test is started again
- ZABBIX 5.0 monitoring client
- [Gurobi] 简单模型的建立
- How to use C language code to realize the addition and subtraction of complex numbers and output structure
- Laravel page load problem connection reset - PHP
- MySQL中的文本处理函数整理,收藏速查
猜你喜欢
Moher College webmin unauthenticated remote code execution
Devops Practice Guide - reading notes (long text alarm)
谷歌官方回应:我们没有放弃TensorFlow,未来与JAX并肩发展
Go learning notes - constants
论文学习——基于极值点特征的时间序列相似性查询方法
Oceanbase is the leader in the magic quadrant of China's database in 2021
1. Getting started with QT
墨者学院-Webmin未经身份验证的远程代码执行
How to send mail with Jianmu Ci
墨者学院-PHPMailer远程命令执行漏洞溯源
随机推荐
JVM中堆概念
Go h*ck yourself:online reconnaissance (online reconnaissance)
What determines vacuum permittivity and vacuum permeability? Why do these two physical quantities exist?
团体程序设计天梯赛-练习集 L1-006 连续因子
Text processing function sorting in mysql, quick search of collection
Amd RX 7000 Series graphics card product line exposure: two generations of core and process mix and match
Add log file to slim frame - PHP
JVM -- class loading process and runtime data area
[go basics] 1 - go go
Example analysis of C # read / write lock
How does dataframe calculate the average value of each row as another column
墨者学院-phpMyAdmin后台文件包含分析溯源
Leetcode (215) -- the kth largest element in the array
The right way to capture assertion failures in NUnit - C #
Leetcode 146. LRU 缓存
Detailed introduction to the big changes of Xcode 14
Oracle stored procedures and functions
Devops Practice Guide - reading notes (long text alarm)
How to set multiple selecteditems on a list box- c#
Laravel page load problem connection reset - PHP