当前位置:网站首页>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;
}
边栏推荐
- Oracle-存储过程与函数
- Moher College phpmailer remote command execution vulnerability tracing
- L1-022 odd even split (10 points)
- Introduction to sap commerce cloud B2B organization function
- Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
- Linear algebra 1.1
- Would you like to go? Go! Don't hesitate if you like it
- Moher college phpMyAdmin background file contains analysis traceability
- ZABBIX monitoring system custom monitoring content
- 神经网络入门(下)
猜你喜欢

zabbix监控系统邮件报警配置

BUUCTF(4)

墨者学院-phpMyAdmin后台文件包含分析溯源

L1-027 rental (20 points)

谷歌官方回应:我们没有放弃TensorFlow,未来与JAX并肩发展

Sqli labs download, installation and reset of SQL injection test tool one of the solutions to the database error (# 0{main}throw in d:\software\phpstudy_pro\www\sqli labs-...)

Handwritten easy version flexible JS and source code analysis

论文学习——基于极值点特征的时间序列相似性查询方法
![[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?

Distributed transaction management DTM: the little helper behind "buy buy buy"
随机推荐
BUUCTF(3)
[performance test] read JMeter
【性能测试】一文读懂Jmeter
Leetcode 146. LRU cache
Oracle-存储过程与函数
如何用MOS管来实现电源防反接电路
Leetcode(215)——数组中的第K个最大元素
Example analysis of C # read / write lock
Leetcode 23. Merge K ascending linked lists
R language uses cforest function in Party package to build random forest based on conditional inference trees, uses varimp function to check feature importance, and uses table function to calculate co
1. Kalman filter - the best linear filter
MySQL中的文本處理函數整理,收藏速查
Difference between static method and non static method (advantages / disadvantages)
Moher College phpmailer remote command execution vulnerability tracing
Devops Practice Guide - reading notes (long text alarm)
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
[gurobi] establishment of simple model
Sports [running 01] a programmer's half horse challenge: preparation before running + adjustment during running + recovery after running (experience sharing)
博客停更声明
C # implements a queue in which everything can be sorted