题目链接:

https://cn.vjudge.net/problem/ZOJ-3286

题目大意:

f(n)为n的因子个数

求出有多少个f(i)使得f(i) == f(n) && i < n

解题思路:

打表出因子个数,然后直接记录因子个数这个值出现次数,记录答案即可

 #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, m;
const int maxn = 1e6 + ;
int num[maxn];//记录因子数目
int tot[maxn];//记录因子数为i出现的次数
int ans[maxn];
int main()
{
for(int i = ; i < maxn; i++)
{
num[i]++;
for(int j = i * ; j < maxn; j += i)
num[j]++;
}
for(int i = ; i < maxn; i++)
ans[i] = tot[num[i]], tot[num[i]]++;
while(cin >> n)
cout<<ans[n]<<endl;
return ;
}

ZOJ-3286 Very Simple Counting---因子数打表的更多相关文章

  1. zoj 3286 Very Simple Counting---统计[1,N]相同因子个数

    Very Simple Counting Time Limit: 1 Second      Memory Limit: 32768 KB Let f(n) be the number of fact ...

  2. 17997 Simple Counting 数学

    17997 Simple Counting 时间限制:2000MS  内存限制:65535K提交次数:0 通过次数:0 题型: 编程题   语言: 不限定 Description Ly is craz ...

  3. Access中创建子数据表/主子数据表

    摘 要:我们为什么要使用Access,而不用Excel,因为数据库可以大幅度地消除冗余数据,其方法就是将数据拆分到不同的表中,再通过“关系”建立表间的联系.那么如何确定表间的关系呢.表之间的关系是通过 ...

  4. TOJ 1258 Very Simple Counting

    Description Let f(n) be the number of factors of integer n. Your task is to count the number of i(1 ...

  5. ZOJ 3686 A Simple Tree Problem

    A Simple Tree Problem Time Limit: 3 Seconds      Memory Limit: 65536 KB Given a rooted tree, each no ...

  6. zoj 1763 A Simple Question of Chemistry

    A Simple Question of Chemistry Time Limit: 2 Seconds      Memory Limit: 65536 KB Your chemistry lab ...

  7. zoj 3686 A Simple Tree Problem (线段树)

    Solution: 根据树的遍历道的时间给树的节点编号,记录下进入节点和退出节点的时间.这个时间区间覆盖了这个节点的所有子树,可以当做连续的区间利用线段树进行操作. /* 线段树 */ #pragma ...

  8. ZOJ 3686 A Simple Tree Problem(线段树)

    Description Given a rooted tree, each node has a boolean (0 or 1) labeled on it. Initially, all the ...

  9. HDU 5795 A Simple Nim (博弈 打表找规律)

    A Simple Nim 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5795 Description Two players take turns ...

随机推荐

  1. 九度oj题目1019:简单计算器

    题目1019:简单计算器 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6346 解决:2334 题目描述:     读入一个只包含 +, -, *, / 的非负整数计算表达式,计算该表达 ...

  2. JS中的事件冒泡和事件捕获

    事件捕获阶段:事件从最上一级标签开始往下查找,直到捕获到事件目标(target). 事件冒泡阶段:事件从事件目标(target)开始,往上冒泡直到页面的最上一级标签. 用图示表示如下: 1.冒泡事件: ...

  3. KVC、KVO实现过程

    1.KVC的实现过程 以 [object setValue:@"134567" forKey:@"uid"];为例子,来探究KVC的实现过程 第一步:搜索1.首 ...

  4. cesium运行环境搭建

    cesiumjs是什么 一个世界级3D地球仪和地图的开源JavaScript库. 1.安装node.js 环境 1)下载node.js 官网:https://nodejs.org/en/ 下载完成后双 ...

  5. docker创建nginx镜像

    注意:此处不是用的dockerfile创建的镜像,只是用来搞一搞 首先你的系统里面要安装docker,这里就不重复介绍了,可以看之前的文章: 然后再搞一个基础镜像 docker pull regist ...

  6. .net HttpClient的使用

    在程序用调用 Http 接口.请求 http 资源.编写 http 爬虫等的时候都需要在程序集中进行 Http 请 求.  很多人习惯的 WebClient.HttpWebRequest 在 TPL ...

  7. easyui表单校验拓展

    /** * Created by chaozhou on 2016/5/30. */ /** * 扩展的基本校验规则, */ $.extend($.fn.validatebox.defaults.ru ...

  8. C#基础:传入URL,获得Http Post

    #region 传入url,获得Http Post public string HttpGet(string url) { string result = string.Empty; try { va ...

  9. tsung

    要做针对mongodb的压力测试,下了个tsung,看看他的策略是什么,目前定位ts_launcher.erl:do_launch({Intensity, MyHostName, PhaseId})- ...

  10. Spring相关概念的理解理解

    spring 框架的优点是一个轻量级比较简单易学的框架,实际使用中的有点优点有哪些呢!1.降低了组件之间的耦合性 ,实现了软件各层之间的解耦 2.可以使用容易提供的众多服务,如事务管理,消息服务等 3 ...