#include<stdio.h>
#include<iostream>
#include<queue>
#include<memory.h>
#include <math.h>
#include<time.h>
#include <stdlib.h>
using namespace std; const int MAX = * ;
const int MAXL = * ;
/**
* 欧拉素数筛选法
*/
int prime[MAX];
int np = ;
void primes()
{
memset(prime, -, sizeof(prime));
for(int i = ; i <= MAXL; i++)
{
if(prime[i] == -)
prime[np++] = i;
for(int j = ; j < np && prime[j] * i <= MAXL; j++)
{
if(prime[j] * i >= MAXL)
{
break;
}
prime[prime[j] * i] = ;
if(i % prime[j] == )
break;
}
}
}
int main()
{
freopen("d:\\1.txt", "r", stdin);
primes();
long long l;
bool first = true;
while (cin >> l)
{
if(l == -)
return ;
for(int i = ; i < np && prime[i] <= l; i++)
{
while (l % prime[i] == )
{
l = l / prime[i];
printf(" %d\n", prime[i]);
}
}
if(l != )
{
printf(" %lld\n", l);
}
cout << endl;
}
return ;
}

最新文章

  1. ubuntu 启动MySql和安装python的MySQLdb模块
  2. iOS 启动图那些坑
  3. 工作中遇到的小问题: 做弹幕从数据库取出东西均匀插入marquee中,
  4. jspace2d——A free 2d multiplayer space shooter
  5. 大话string
  6. 它们的定义actionbar 并删除留空
  7. diy51单片机最小系统------从零件到51整体测试成功小白篇
  8. 使用XIB实现嵌套自定义视图
  9. redis 系列12 哈希对象
  10. Python3学习之路~9.1 paramiko模块:实现ssh执行命令以及传输文件
  11. 全网最详细的基于Ubuntu14.04/16.04 + Anaconda2 / Anaconda3 + Python2.7/3.4/3.5/3.6安装Tensorflow详细步骤(图文)(博主推荐)
  12. Confluence 6 恢复一个空间
  13. “一切都是消息”--iMSF(即时消息服务框架)入门简介
  14. Java编译报错:意外的类型
  15. android studio 3.0 安装配置
  16. Ansible之ansible-playbook roles
  17. Python3.x:os.chdir(改变当前路径方法)介绍
  18. python 2.7中安装mysql
  19. sql数据库表容量
  20. BZOJ:2460[BeiJing2011]元素 (异或基+贪心)

热门文章

  1. 国内Ubuntu镜像源
  2. 51Nod:活动安排问题之二(贪心)
  3. 【分形】【洛谷P1498】
  4. jsp页面编写锚点,和html页面编写锚点
  5. C语言命令行解析函数:getopt/getopt_long
  6. MySQL Inception--原理和注意事项
  7. SolrCloud6.3 单机、集群、内置jetty、tomcat搭建、对collection操作
  8. ShareMemory
  9. 标 题: Re: 总感觉IT没我大山东啥事?
  10. Upgrade to or Install Cinnamon 2.4 in Ubuntu