ZOJ-3286 Very Simple Counting---因子数打表
题目链接:
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---因子数打表的更多相关文章
- 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 ...
- 17997 Simple Counting 数学
17997 Simple Counting 时间限制:2000MS 内存限制:65535K提交次数:0 通过次数:0 题型: 编程题 语言: 不限定 Description Ly is craz ...
- Access中创建子数据表/主子数据表
摘 要:我们为什么要使用Access,而不用Excel,因为数据库可以大幅度地消除冗余数据,其方法就是将数据拆分到不同的表中,再通过“关系”建立表间的联系.那么如何确定表间的关系呢.表之间的关系是通过 ...
- 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 ...
- ZOJ 3686 A Simple Tree Problem
A Simple Tree Problem Time Limit: 3 Seconds Memory Limit: 65536 KB Given a rooted tree, each no ...
- zoj 1763 A Simple Question of Chemistry
A Simple Question of Chemistry Time Limit: 2 Seconds Memory Limit: 65536 KB Your chemistry lab ...
- zoj 3686 A Simple Tree Problem (线段树)
Solution: 根据树的遍历道的时间给树的节点编号,记录下进入节点和退出节点的时间.这个时间区间覆盖了这个节点的所有子树,可以当做连续的区间利用线段树进行操作. /* 线段树 */ #pragma ...
- 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 ...
- HDU 5795 A Simple Nim (博弈 打表找规律)
A Simple Nim 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5795 Description Two players take turns ...
随机推荐
- WINDOWS安装mysql5.7.20
MSI安装包链接 http://pan.baidu.com/s/1mhI0SMO 提取密码 gaqu 安装前要把老版本的MYSQL卸载干净 之前用官网的archive免安装版安装一直失败,放弃,用MS ...
- angularjs 判断是否包含 permIDs|filter:'10'
<div class="span12 tools"> <ul class="row-fluid" id=&quo ...
- vuex 实现vue中多个组件之间数据同步以及数据共享。
http://pan.baidu.com/s/1hrJfpli demo下载地址 前言 在一些项目中有很多数据状态之间要实现数据共享状态共享,例如购物车的数据.用户的登录状态等等.vue父元素是可以 ...
- linux免密登录ssh验证配置方法及常见错误解决
目标:从服务器A免密登录服务器B [配置方法] 1.在服务器A生成密钥文件,直接使用以下命令: ssh-keygen 中间遇到输入内容一路回车即可,完成后会在 ~/.ssh 目录下生成两个文件:id_ ...
- post方式发送接收文件
//文件post发送 var express = require('express');var router = express.Router();var request = require(&quo ...
- DataGridView初始化,加载数据
1,创建winform窗体应用程序 2,在界面上拖入DataGridView控件 3,添加相应的列如图: 4,开始编写后面的代码: private DataTable CountryDt = new ...
- 封装hiredis——C++与redis对接(一)(string的SET与GET操作)
在菜鸟教程自学了redis,总想着像Mysql一样,在C/C++中进行对接.于是查询了一些资料,最后找到了hiredis.然而直接用它的话,难免有点不方便.于是,对其进行封装. hiredis直接去g ...
- pyhton基础中的要点一
1.python变量的命名规范: (1)变量必须以数字,字母,下划线的任意组合 (2)变量建议用驼峰标识,或下划线 (3)变量要有可描述性 (4)不能以数字开头 (5)不能用python的关键字 (6 ...
- css之表格,表单
一.表格 1.定义 表格由<table>标签来定义.每个表格均有若干行(由tr标签定义),每行被分割为若个单元格(由td标签定义).字母td指表格数据(table data),即数据单元格 ...
- 初识 ElasticSearch
场景:最近有同事分享了ElasticSearch Inverted Index,所以自己也了解一下基于Lucene的ES. 转载自:http://www.jianshu.com/p/05cff7175 ...