Easy Number Challenge(暴力,求因子个数)
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u
System Crawler (2016-04-26)
Description
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:

Find the sum modulo 1073741824(230).
Input
The first line contains three space-separated integers a, b and c (1 ≤ a, b, c ≤ 100).
Output
Print a single integer — the required sum modulo 1073741824(230).
Sample Input
2 2 2
20
5 6 7
1520
Hint
For the first example.
- d(1·1·1) = d(1) = 1;
- d(1·1·2) = d(2) = 2;
- d(1·2·1) = d(2) = 2;
- d(1·2·2) = d(4) = 3;
- d(2·1·1) = d(2) = 2;
- d(2·1·2) = d(4) = 3;
- d(2·2·1) = d(4) = 3;
- d(2·2·2) = d(8) = 4.
So the result is 1 + 2 + 2 + 3 + 2 + 3 + 3 + 4 = 20.
题解:
d(x)代表x的因子的个数;还好i,j,k都不大,100,暴力就行,直接由于因子个数等于质因子的系数加一之积,反素数讲过,由此可得;
代码:
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<iostream>
#include<set>
#define ll long long
#define MOD 1073741824
using namespace std;
int num[];
int main()
{
int a,b,c;
int i,j,k;
while(scanf("%d%d%d",&a,&b,&c)!=EOF)
{
memset(num, , sizeof(num));
ll sum=, temp;
set<int>st;
set<int>::iterator iter;
for(i=;i<=a;i++)
{
for(j=;j<=b;j++)
{
for(k=;k<=c;k++)
{
temp = i * j * k;
ll cnt = ;
for(int p = ; p <= temp; p++){
if(temp % p == ){
int cur = ;
while(temp % p == ){
temp /= p;
cur++;
}
cnt *= cur + ;
}
}
sum += cnt;
sum %= MOD;
}
}
} printf("%lld\n",sum);
}
return ;
}
Easy Number Challenge(暴力,求因子个数)的更多相关文章
- 『NYIST』第八届河南省ACM竞赛训练赛[正式赛一]CF-236B. Easy Number Challenge
B. Easy Number Challenge time limit per test 2 seconds memory limit per test 256 megabytes input sta ...
- Trailing Zeroes (I) LightOJ - 1028(求因子个数)
题意: 给出一个N 求N有多少个别的进制的数有后导零 解析: 对于一个别的进制的数要转化为10进制 (我们暂且只分析二进制就好啦) An * 2^(n-1) + An-1 * 2^(n-2) + `` ...
- Almost All Divisors(求因子个数及思维)
---恢复内容开始--- We guessed some integer number xx. You are given a list of almost all its divisors. Alm ...
- LightOj1028 - Trailing Zeroes (I)---求因子个数
题目链接:http://lightoj.com/volume_showproblem.php?problem=1028 题意:给你一个数 n (1<=n<=10^12), 然后我们可以把它 ...
- POJ 2992 Divisors (求因子个数)
题意:给n和k,求组合C(n,k)的因子个数. 这道题,若一开始先预处理出C[i][j]的大小,再按普通方法枚举2~sqrt(C[i][j])来求解对应的因子个数,会TLE.所以得用别的方法. 在说方 ...
- Number of Parallelograms(求平行四边形个数)
Number of Parallelograms time limit per test 4 seconds memory limit per test 256 megabytes input sta ...
- HDU-1492-The number of divisors(约数) about Humble Numbers -求因子总数+唯一分解定理的变形
A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, ...
- BZOJ3994:约数个数和(莫比乌斯反演:求[1,N]*[1,M]的矩阵的因子个数)
Description 设d(x)为x的约数个数,给定N.M,求 Input 输入文件包含多组测试数据. 第一行,一个整数T,表示测试数据的组数. 接下来的T行,每行两个整数N.M. Outpu ...
- Divisors (求解组合数因子个数)【唯一分解定理】
Divisors 题目链接(点击) Your task in this problem is to determine the number of divisors of Cnk. Just for ...
随机推荐
- pyqt动态创建一系列组件并绑定信号和槽(网友提供学习)
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' #如上图要求:创建指定多个复选框,一种是通过QT设计器Designe ...
- PHP冒泡排序,选择排序,插入排序
1 冒泡排序是两个元素相互比较,找到最小值,然后冒泡到最后,代码如下:
- Jpeg(模拟)
Jpeg Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status ...
- NPOI之使用EXCEL模板创建报表
因为项目中要用到服务器端创建EXCEL模板 无法直接调用EXCEL 查了下发现NPOI很方便很简单就实现了 其中走了点弯路 第一次弄的时候发现输出的值是文本不是数字型无法直接计算公式 然后又发现打开报 ...
- Oracle—RMAN备份(二)
在Oracle RMAN备份(一)中,对各种文件在RMAN中备份进行了说明, 一.备份集的复制 在RMAN 备份中,可以备份其自己的备份,即备份一个文件放在多个目录下,oralce支持最多备份四个. ...
- 使用INTERVAL YEAR TO MONTH类型
Oracle Database 9i数据库引入了一种新特性,可以用来存储时间间隔.时间间隔的例子包括: ● 1年零3个月 ● 25个月 ● -3天5小时16分 ● 1天7小时 ● -56小时 注意: ...
- [HeadFirst-JSPServlet学习笔记][第一章:前言与概述]
第一章 前言与概述 web服务器做什么? 答:接收客户请求,然后向客户返回结果 web客户做什么? 答:此处客户指浏览器,web客户允许用户请求服务器上的某个资源,并向用户展现请求的结果. html ...
- last与lastlog命令
lastlog 列出所有用户最后登录的时间和登录终端的地址,如果此用户从来没有登录,则显示:**Never logged in**last 列出用户所有的登录时间和登录终端的地址
- jQuery 事件 - error() 方法
实例 如果图像不存在,则用一段预定义的文本取代它: $("img").error(function(){ $("img").replaceWith(" ...
- GDI+创建Graphics对象的2种方式
1.this.CreateGraphics() // 调用控件的CreateGraphics()方法 2.在OnPaint事件中,PaintEventArgs类型的参数e对象的Graphi ...