当前位置:网站首页>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;
}
边栏推荐
- SQL注入测试工具之Sqli-labs下载安装重置数据库报错解决办法之一(#0{main}thrown in D:\Software\phpstudy_pro\WWW\sqli-labs-……)
- What does range mean in PHP
- L1-030 one gang one (15 points)
- University stage summary
- Activiti常見操作數據錶關系
- [Gurobi] 简单模型的建立
- Wechat has new functions, and the test is started again
- Difference between static method and non static method (advantages / disadvantages)
- MySQL中的文本处理函数整理,收藏速查
- Handwritten easy version flexible JS and source code analysis
猜你喜欢

yolov5 xml数据集转换为VOC数据集

University stage summary

Project 1 household accounting software (goal + demand description + code explanation + basic fund and revenue and expenditure details record + realization of keyboard access)

zabbix监控系统邮件报警配置

This article is enough for learning advanced mysql

【Go基础】1 - Go Go Go

Advanced MySQL: Basics (5-8 Lectures)

Go learning notes - constants
![[Gurobi] 简单模型的建立](/img/3f/d637406bca3888b939bead40b24337.png)
[Gurobi] 简单模型的建立

ZABBIX 5.0 monitoring client
随机推荐
L1-026 I love gplt (5 points)
21 examples of strategic goals to promote the rapid development of your company
Laravel page load problem connection reset - PHP
神经网络入门(下)
[network security] what is emergency response? What indicators should you pay attention to in emergency response?
Oracle-存储过程与函数
Activiti common operation data table relationship
L1-022 odd even split (10 points)
1. Kalman filter - the best linear filter
时序数据库 InfluxDB 2.2 初探
One of the general document service practice series
[real case] how to deal with the failure of message consumption?
Email alarm configuration of ZABBIX monitoring system
How to reset IntelliSense in vs Code- How to reset intellisense in VS Code?
Scanf read in data type symbol table
How to use C language code to realize the addition and subtraction of complex numbers and output structure
Leetcode (215) -- the kth largest element in the array
L1-027 rental (20 points)
Moher College webmin unauthenticated remote code execution
L1-028 judging prime number (10 points)