题目链接

https://www.patest.cn/contests/gplt/L1-006

思路

输出的连续因子 的乘积 也要是这个数的因子 就每个数先找它的单因子

然后每个单因子往上一个一个遍历 当 n % sum != 0 的时候 退出来 然后 比较 此答案 和 原答案的大小 如果 更大 就替换

要注意 质数的情况

AC代码

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <cstdlib>
#include <ctype.h>
#include <numeric>
#include <sstream> using namespace std;
typedef long long LL; const double PI = 3.14159265358979323846264338327;
const double E = 2.718281828459;
const double eps = 1e-6; const int MAXN = 0x3f3f3f3f;
const int MINN = 0xc0c0c0c0;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7; int a[maxn]; int main()
{
int n;
cin >> n;
int i, j;
int vis = sqrt(n) + 1;
memset(a, 0, sizeof(a));
int temp;
for (i = 2, j = 0; i <= vis; i++)
{
if (n % i == 0)
a[j++] = i;
}
int len = j;
int max = 0, ans;
LL sum;
for (i = 0; i < len; i++)
{
sum = a[i];
vis = 1;
for (j = 1; ; j++)
{
sum *= (a[i] + j);
if (n % sum != 0)
break;
else
vis++;
}
if (vis > max)
{
max = vis;
ans = a[i];
}
}
if (len == 0)
{
cout << 1 << endl;
cout << n << endl;
}
else
{
printf("%d\n", max);
for (i = 0; i < max; i++)
{
if (i)
printf("*");
printf("%d", ans + i);
}
cout << endl;
}
}

最新文章

  1. 使用Nito.AsyncEx实现异步锁(转)
  2. ffmpeg-20160828-bin.7z
  3. java数据库连接池性能对比
  4. python requests库学习
  5. VS2010中无法嵌入互操作类型“......”,请改用适用的接口的解决方法
  6. Linq to Entities不识别方法
  7. 【JSP实例】指定用户计数器
  8. php多进程编程详解
  9. SQL SERVER 的前世今生--各版本功能对比
  10. 实验效果展示(会声会影+FSCapture)
  11. Android6.0 源码修改之 仿IOS添加全屏可拖拽浮窗返回按钮
  12. mysql case when 判断null
  13. 静态HTML总结
  14. win10下安装MinGW-w64 - for 32 and 64 bit Windows
  15. C#控制台程序输出彩色文字
  16. Python MySQLdb insert(插入) 封装
  17. Python入门之字符编码
  18. 【bzoj 4154】[Ipsc2015]Generating Synergy
  19. Spring整合MyBatis(四)MapperFactoryBean 的创建
  20. Kali渗透测试2-抓包/DNS工具

热门文章

  1. 第八章 springboot + mybatis + 多数据源3(使用切面AOP)
  2. UTF-8和GBK的区别
  3. ACM Computer Factory - poj 3436 (最大流)
  4. ffmpeg中的x264编码选项,对应关系
  5. Matlab命令行版打开
  6. 椭圆参数方程中的θ(离心角Theta)
  7. PRINTDLG 打印对话框操作
  8. FTP(File Transfer Protocol)是什么?
  9. OC对象给分类加入属性
  10. Android开发:拖拽