当前位置:网站首页>[PTA] l1-006 continuity factor
[PTA] l1-006 continuity factor
2022-04-23 20:23:00 【Maybe】
Original link
ac Code
Pay attention to the error prone points and optimization methods in the notes
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<map>
using namespace std;
int main() {
int n;
cin >> n;
int len = 0, st = 0;
for(int i = 2; i <= sqrt(n); i++) {
//sqrt(n) Then there can be no continuity factor
int temp = n;
if(!(temp % i)) {
int templ = 0, tempst = i;
int t = i;// Because it's a grouping factor , So it's possible to remove the front , Add the back , More cases of continuity factors , use t temporarily replace i
while(!(temp % t)) {
// Here, the continuous factor does not refer to the divisible factor used , But in groups
temp /= t++;
templ++;
}
if(templ > len) {
len = templ;
st = tempst;
}
}
}
if(len) {
cout << len << endl;
for(int i = st; i < st + len - 1; i++) {
cout << i << '*';
}
cout << st + len - 1;
}else{
cout << 1 << endl << n;// Prime cannot find intermediate factor , Previous searches will not record , Number of individual outputs 1 And it itself
}
return 0;
}
版权声明
本文为[Maybe]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204232020000314.html
边栏推荐
- 2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
- Remote code execution in Win 11 using wpad / PAC and JScript 3
- R language ggplot2 visual facet_wrap, and use the lineheight parameter to customize the height of the facet icon tab (gray label bar)
- 【PTA】L1-002 打印沙漏
- Browser - learning notes
- PCL点云处理之基于PCA的几何形状特征计算(五十二)
- Common form verification
- . Ren -- the intimate artifact in the field of vertical Recruitment!
- 论文写作 19: 会议论文与期刊论文的区别
- Paper writing 19: the difference between conference papers and journal papers
猜你喜欢
DNS cloud school | quickly locate DNS resolution exceptions and keep these four DNS status codes in mind
Wave field Dao new species end up, how does usdd break the situation and stabilize the currency market?
Leetcode dynamic planning training camp (1-5 days)
SQL Server Connectors By Thread Pool | DTSQLServerTP 插件使用说明
【PTA】L1-002 打印沙漏
BMP JPEG 图片转换为矢量图像 ContourTrace
[latex] 5 how to quickly write out the latex formula corresponding to the formula
Handwritten Google's first generation distributed computing framework MapReduce
How can matlab obtain the truncated image in trainingimagelabeler
Fundamentals of network communication (LAN, Wan, IP address, port number, protocol, encapsulation and distribution)
随机推荐
[problem solving] 'ASCII' codec can't encode characters in position XX XX: ordinal not in range (128)
Some basic knowledge of devexpress report development
ABAQUS script email auto notification
网络通信基础(局域网、广域网、IP地址、端口号、协议、封装、分用)
Five minutes to show you what JWT is
PostgreSQL basic functions
ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
selenium. common. exceptions. WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
go-zero框架数据库方面避坑指南
論文寫作 19: 會議論文與期刊論文的區別
Linux64Bit下安装MySQL5.6-不能修改root密码
2022 - Data Warehouse - [time dimension table] - year, week and holiday
16MySQL之DCL 中 COMMIT和ROllBACK
SQL Server Connectors By Thread Pool | DTSQLServerTP 插件使用说明
[graph theory brush question-4] force deduction 778 Swimming in a rising pool
Redis distributed lock
微信中金财富高端专区安全吗,证券如何开户呢
NC basic usage 1
中金财富公司怎么样,开户安全吗
R language uses the preprocess function of caret package for data preprocessing: BoxCox transform all data columns (convert non normal distribution data columns to normal distribution data and can not