zoukankan      html  css  js  c++  java
  • hdoj1164

    Eddy's research I

     1 #include<iostream>
     2 #include<string.h>
     3 #include<stdio.h>
     4 using namespace std;
     5 int prime[10000],cnt,n;
     6 bool primtmp[65538];
     7 int main(){
     8     cnt=0;
     9     memset(primtmp,-1,sizeof(primtmp));
    10      for(int i=2;i<=65535;++i){//求素数
    11         if(primtmp[i]){
    12             prime[cnt++]=i;
    13             int p=2*i;
    14             while(p<=65535){
    15                 primtmp[p]=0;
    16                 p+=i;
    17             }
    18         }
    19     }
    20       while(scanf("%d",&n)!=EOF){
    21     int pos=0;
    22     while(n>1){
    23     while(n%prime[pos]==0){
    24         printf("%d",prime[pos]);
    25         n/=prime[pos];
    26         if(n>1)
    27             printf("*");
    28        }
    29         pos++;
    30      }
    31     printf("\n");
    32     }
    33 }


  • 相关阅读:
    poj 图算法
    类里二级排序函数使用
    数学题目(高斯消元)
    多校联合比赛部分题目
    poj 3007 & poj 3096
    优先队列
    hdu 各种 A + B
    几道数学题目
    今天下午
    Java常用的几种设计模式
  • 原文地址:https://www.cnblogs.com/Open_Source/p/1904958.html
Copyright © 2011-2022 走看看