HDU_2136
#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的更多相关文章
- HDU_2136——最大质因数,素数筛选法
Problem Description Everybody knows any number can be combined by the prime number. Now, your task i ...
随机推荐
- python基础学习Day15 面向对象、类名称空间、对象名称空间 (2)
一.类 先看一段代码: class Person: animal = '高级动物' walk_way = '直立行走' # 静态属性,静态变量,静态字段 language = '语言' def __i ...
- tomcat 启动报错 Invalid character found in method name. HTTP method names must be tokens
解决:Invalid character found in method name. HTTP method names must be tokens 阿里云上弄了一个tomcat,经常半夜发送崩 ...
- php预定义字符
Php中预定义字符的处理: 1,htmlspecialchars()把一些预定义的字符转换为 HTML 实体. 函数原型:htmlspecialchars(string,quotestyle,char ...
- 移动端引用echarts的折线图
移动端写一个图表引用echarts,highcharts插件,本次要找一个能够显示最新数据的折线图,最后只找到显示最大值: 找到echarts的实例:记一下个各功能. <!DOC ...
- mysql攻防之写入漏洞
因为被别人利用mysql攻击,所以想在这里帮助大家提高一下自身mysql的安全.避免成为别人的肉鸡. show global variables like '%secure%'; 如果是这样则黑客可以 ...
- SVN获取最新代码,完成后续开发
1.新建一个文件夹,鼠标右键点击文件夹,点击Checkout 2.填写两个路径(项目路径和下载到路径),并确认“ok”
- centos静态绑定IP地址
Centos7 /etc/sysconfig/network-scripts/ifcfg-ens33
- NDK环境搭建方法2
1.新建项目NDKDemo3 2.新建com.example.shixm.ndkdemo3.MyNdk.java 3.右键main文件夹,New->Folder->JNI Folder 4 ...
- TabError的解决方法
问题:Python文件运行时报TabError: inconsistent use of tabs and spaces in indentation 原因:说明Python文件中混有Tab和Spac ...
- ACM-ICPC 2018 沈阳赛区网络预赛 F. Fantastic Graph (贪心或有源汇上下界网络流)
"Oh, There is a bipartite graph.""Make it Fantastic."X wants to check whether a ...