#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;
// hdu 2136
/*
0 1 2 3 4 5 6 7 8 9 10 11
1 0 1 1 1 1 1
1 0 1 2 1 2 1 2 1
1 0 1 2 1 3 2 1 2 3
1 0 1 2 1 3 2 4 1 2 3
1 0 1 2 1 3 2 4 1 2 3
1 0 1 2 1 3 2 4 1 2 3 5 */
const int MAXN=1e6+;
int prime[MAXN]={}, pos=; void get_prime(){
for(int i=; i<MAXN; i++){
if(!prime[i]){
pos++;
for(int j=; i*j<MAXN; j++){
prime[i*j]=pos;
}
}
}
} int main(){
get_prime();
int n;
while(~scanf("%d", &n)){
printf("%d\n", prime[n]);
}
return ;
}

HDU_2136的更多相关文章

  1. HDU_2136——最大质因数,素数筛选法

    Problem Description Everybody knows any number can be combined by the prime number. Now, your task i ...

随机推荐

  1. Memory Controller

    1.S3C6410 地址空间 For memory at the table details 2. SDRAM图解 3. SDRAM 芯片容量计算: L_BANK 数目 * 一个 L_BANK 中的单 ...

  2. 一些常见的js问题总结

  3. php loop循环 拿到键名

    {loop $nianjian['dache'] $key  $v}        $key能拿到键名(微擎系统试过可以)

  4. JS-cookie和正则表达式

    一 cookie 1 什么是cookie? 会话跟踪技术 2 作用 验证身份,存储信息. 3 特点 大小限制,最多存4k: 每个域下只能存50个cookie: 有时间限制: 只能存放字符串: 只能访问 ...

  5. TF-IDF原理及使用

    1.TF-IDF(Term Frequency-Inverse Document Frequency, 词频-逆文件频率).(逆文档词频) 2.自我理解: 公式TF = $$\frac{语料库中关键词 ...

  6. oracle学习--循环语句

    oracle学习--循环语句  loop循环: create or replace procedure pro_test_loop is i number; begin i:=0; loop i:=i ...

  7. python内置函数getattr用法

    class Tests(object):    #定义类     aaa = '10'          #定义变量       def test(self):     #定义类的方法test     ...

  8. 变态跳台阶(python)

    题目描述 一只青蛙一次可以跳上1级台阶,也可以跳上2级……它也可以跳上n级.求该青蛙跳上一个n级的台阶总共有多少种跳法. # -*- coding:utf-8 -*- class Solution: ...

  9. 源码调用ffmpeg库时,需要注意接口为C接口

    即引用相关头文件时候,要使用extern "C"{}来包含. 关于extern "C"{}的详情,参考:http://www.cnblogs.com/skyne ...

  10. sizeof 4字节对齐

    #include <iostream> #include<assert.h> using namespace std; typedef struct sys{ char a; ...