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 ...
随机推荐
- mongodb数据导入导出mongoexport/mongoimport
数据导出 mongoexport 假设库里有一张user表,里面有2条记录,我们要将它导出 > use my_mongodb switched to db my_mongodb > db. ...
- Redis双机热备方案--转
http://luyx30.blog.51cto.com/1029851/1350832 参考资料: http://patrick-tang.blogspot.com/2012/06/redis-ke ...
- 从Word中拷贝字段用于MySQL建表
1.SQL 基础表 建立 USE [Test] GO /****** Object: Table [dbo].[CreateTable] Script Date: 10/17/2016 14:07:1 ...
- php发送邮件功能(PHPMailer-master插件)
当作一个插件使用即可,放到网站根目录,然后调用里面的mail.php 源码
- web.xml配置文件中async-supported报错解决
项目中配置spring时async-supported报错: 是因为<async-supported>true</async-supported>是web.xml 3.0的新特 ...
- Springmvc file多附件上传 显示 删除操作
之前项目需求要做一个多附件上传 并显示上传文件 带删除操作 一筹莫展之际搜到某个兄弟发的博客感觉非常好用被我copy下来了此贴算是改良版 再次感谢(忘记叫什么了时间也有点久没有历史记录了)先上图 基于 ...
- JAVA常用单词
柠檬学院Java 基础常见英语词汇(共 70 个)OO: object-oriented ,面向对象 OOP: object-oriented programming,面向对象编程JDK:Java d ...
- GET和POST请求的区别如下
POST和GET都是向服务器提交数据,并且都会从服务器获取数据. 区别: 1.传送方式:get通过地址栏传输,post通过报文传输. 2.传送长度:get参数有长度限制(受限于url长度),而post ...
- Java String、string[]、List初始化方法
String初始化: 1.String str = new String("string1"); 2.String str = "string1"; Strin ...
- css之表格,表单
一.表格 1.定义 表格由<table>标签来定义.每个表格均有若干行(由tr标签定义),每行被分割为若个单元格(由td标签定义).字母td指表格数据(table data),即数据单元格 ...