题目链接:

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. Hibernate 一对多自身关联(同一表中子父目录树形结构)

  2. Mybatis 关联查询(二

    一对多的管理查询结果映射   1.进行一对多的查询时候,要在主查询表对应的Po中加入关联查询表对应PO的类的list集合作为属性. public class Orders { private Inte ...

  3. Python基础学习总结(八)

    10.文件和异常 1.学习处理文件,让程序快速的分析大量数据,学习处理错误,避免程序在面对意外时崩溃.学习异常,异常是python创建的特殊对象,用于管理程序运行时出现的错误,提高程序的适用性,可用性 ...

  4. express实现todolist

    app.js var express = require('express'); var todoController = require('./controllers/todoController. ...

  5. ssh和scp详解

    一.SSH客户端使用 使用ssh客户端远程登陆到指定的计算机: $ ssh {user}@{remote} -o IdentityFile=/home/id_rsa -o StrictHostKeyC ...

  6. JavaScript的进阶之路(三)引用类型之Object类型和Array类型

    引用类型 Object类型 function a(num){ if(num>3){ a(--num); } console.log(num); } a(5); //如何创建对象的实例 var o ...

  7. Apache服务器运维笔记(2)----使用<IfDefine>容器实现不同的配置

    还有一种方法用来实现不同配置的Apache服务器启动,就是在一个配置文件中使用<IfDefine name> ... </IfDefine> 容器来定义,在<IfDefi ...

  8. CentOS 7 禁用IPV6以提高网速

    方法 1 编辑文件/etc/sysctl.conf,$vi /etc/sysctl.conf添加下面的行: net.ipv6.conf.all.disable_ipv6 = net.ipv6.conf ...

  9. android中的内部存储与外部存储

    我们先来考虑这样一个问题: 打开手机设置,选择应用管理,选择任意一个App,然后你会看到两个按钮,一个是清除缓存,另一个是清除数据,那么当我们点击清除缓存的时候清除的是哪里的数据?当我们点击清除数据的 ...

  10. RocketMQ读书笔记3——消费者

    [不同类型的消费者] DefaultMQPushConsumer 由系统控制读取操作,收到消息后自动调用传入的处理方法来处理. DefaultMQPullConsumer 读取操作中的大部分功能由使用 ...