题目描述

I'll give you a number , please tell me how many different prime factors in this number.

输入

There is multiple test cases , in each test case there is only one line contains a number N(2<=N<=100000). Process to the end of file.

输出

For each test case , output one line contains one number , indicating different prime factor in the number N.

样例输入

12
5
30

样例输出

2
1
3

提示

12 = 2 * 2 * 3
5 = 5
30 = 2 * 3 * 5 


#include<iostream>
using namespace std;
int a[100001];
void go(){
	memset(a, 0, sizeof(a));
	int i,j;
	for (i = 2; i < 100001;i++)
	if (a[i] == 0){
		for (j = i; j < 100001; j+=i)a[j]++;
	}
}
int main(){
	//freopen("in.txt", "r", stdin);
	int x;
	go();
	while (cin >> x)cout << a[x] << endl;
	return 0;
}

东大OJ-1430-PrimeNumbers的更多相关文章

  1. 东大OJ 2SAT 异或

    看了十年才懂懂了十年才会会了十年才会写写了十年才写完写完了十年才能改对 #include<stdio.h> #include<string.h> struct res{ int ...

  2. 东大OJ-Max Area

    1034: Max Area 时间限制: 1 Sec  内存限制: 128 MB 提交: 40  解决: 6 [提交][状态][讨论版] 题目描述 又是这道题,请不要惊讶,也许你已经见过了,那就请你再 ...

  3. Online Judge(OJ)搭建(第一版)

    搭建 OJ 需要的知识(重要性排序): Java SE(Basic Knowledge, String, FileWriter, JavaCompiler, URLClassLoader, Secur ...

  4. [C#] 逆袭——自制日刷千题的AC自动机攻克HDU OJ

    前言 做过杭电.浙大或是北大等ACM题库的人一定对“刷题”不陌生,以杭电OJ为例:首先打开首页(http://acm.hdu.edu.cn/),然后登陆,接着找到“Online Exercise”下的 ...

  5. oj Rapid Typing

    import bs4 import requests import urllib2 import time import base64 session=requests.Session() respo ...

  6. 在线OJ实用技巧(转载)

    1.一般用C语言节约空间,要用C++库函数或STL时才用C++; cout.cin和printf.scanf最好不要混用. 2.有时候int型不够用,可以用long long或__int64型(两个下 ...

  7. OJ生成器(一)制作Online Judge前的准备和策划

    我这校区新的微机老师斗志昂扬,准备让我们这学校萎靡的信息技术竞赛重振雄风.然后有一次我半开玩笑地说建一个自己的OJ吧,老师也就鼓励我去做了. 开什么玩笑……!我可是马上要参加NOIP的人! 于是老师说 ...

  8. hihoCoder 1430 : A Boring Problem(一琐繁题)

    hihoCoder #1430 : A Boring Problem(一琐繁题) 时间限制:1000ms 单点时限:1000ms 内存限制:256MB Description - 题目描述 As a ...

  9. 【LeetCode OJ】Validate Binary Search Tree

    Problem Link: https://oj.leetcode.com/problems/validate-binary-search-tree/ We inorder-traverse the ...

  10. 【LeetCode OJ】Recover Binary Search Tree

    Problem Link: https://oj.leetcode.com/problems/recover-binary-search-tree/ We know that the inorder ...

随机推荐

  1. x01.FileProcessor: 文件处理

    姚贝娜落选,意味着好声音失败.“我们在一起”的精彩亮相,正如同她的歌声,愈唱愈高,直入云霄. 文件处理,无外乎加解密,加解压,分割合并.本着“快舟"精神,花了两天时间,写了个小程序,基本能满 ...

  2. IE6-11使用location.href提交时的链接复制到firefox或chrome时出现乱码

    这是在开发国际机票查询页时碰到的一个问题,测试工程师在IE里执行查询操作,然后把查询的url赋值到firefox的地址栏,firefox打开后就变成乱码了. 1. IE浏览器,选择出发地,出发日期等后 ...

  3. spring + redis 实现数据的缓存

    1.实现目标 通过redis缓存数据.(目的不是加快查询的速度,而是减少数据库的负担) 2.所需jar包 注意:jdies和commons-pool两个jar的版本是有对应关系的,注意引入jar包是要 ...

  4. To create my first app in iOS with Xcode(在Xcode创建我的第一个iOS app )

    To create my first app in iOS create the project. In the welcome window, click “Create a new Xcode p ...

  5. 基于Bootstrap的DropDownList的JQuery组件的完善版

    在前文 创建基于Bootstrap的下拉菜单的DropDownList的JQuery插件 中,实现了DropDownList的JQuery组件,但是留有遗憾.就是当下拉菜单出现滚动条的时候,滚动条会覆 ...

  6. 跟我一起写 Makefile

    转自 陈皓 的博客:http://blog.csdn.net/haoel/article/details/2886 1. 概述 2. 关于程序的编译和链接 3. Makefile 介绍 4. Make ...

  7. 转:研读代码必须掌握的Eclipse快捷键

    总结的很不错,而且有相应的用法,推荐!!! from: http://www.cnblogs.com/yanyansha/archive/2011/08/30/2159265.html 研读代码必须掌 ...

  8. ef操作类

    基于Hi博客的类库 20160811 using Model; using System; using System.Collections.Generic; using System.Data.En ...

  9. git中的版本回退

    git版本回退有两种情况,一种是从本地版本库中(head区)回退到某个版本,可以用命令 git reset --hard head^ 或git reset --hard head~x ,head指的是 ...

  10. mui禁止横屏显示,仅支持竖屏显示

    mui.plusReady(function () { plus.screen.lockOrientation("portrait-primary"); });