当前位置:网站首页>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;
}
边栏推荐
- Unity-Text上标平方表示形式+text判断文本是否为空
- Amd RX 7000 Series graphics card product line exposure: two generations of core and process mix and match
- Linear algebra 1.1
- Tri des fonctions de traitement de texte dans MySQL, recherche rapide préférée
- 【Go基础】2 - Go基本语句
- Do you know about autorl in intensive learning? A summary of articles written by more than ten scholars including Oxford University and Google
- Using the rate package for data mining
- PHP converts seconds to timestamps - PHP
- How to use MOS tube to realize the anti reverse connection circuit of power supply
- 团体程序设计天梯赛-练习集 L1-006 连续因子
猜你喜欢

BUUCTF(4)

Moher College webmin unauthenticated remote code execution

Moher College phpmailer remote command execution vulnerability tracing

JVM中堆概念

Oracle-存储过程与函数

The idea of implementing charts chart view in all swiftui versions (1.0-4.0) was born

Do you know about autorl in intensive learning? A summary of articles written by more than ten scholars including Oxford University and Google
![[network security] what is emergency response? What indicators should you pay attention to in emergency response?](/img/2e/96da79d82ae2c49a3a0ab9909467ac.jpg)
[network security] what is emergency response? What indicators should you pay attention to in emergency response?

【Go基础】1 - Go Go Go

如何用MOS管来实现电源防反接电路
随机推荐
The right way to capture assertion failures in NUnit - C #
JVM中堆概念
Life planning (flag)
Advanced MySQL: Basics (5-8 Lectures)
[Gurobi] 简单模型的建立
1. Qt入门
Go h*ck yourself:online reconnaissance (online reconnaissance)
Oracle stored procedures and functions
Moher College phpmailer remote command execution vulnerability tracing
Blog stop statement
L1-024 the day after tomorrow (5 points)
Amd RX 7000 Series graphics card product line exposure: two generations of core and process mix and match
团体程序设计天梯赛-练习集 L1-006 连续因子
Sort by item from the list within the list - C #
Text processing function sorting in mysql, quick search of collection
Chrome is set to pure black
深入浅出:了解时序数据库 InfluxDB
[performance test] read JMeter
Wechat has new functions, and the test is started again
This article is enough for learning advanced mysql