Easy Number Challenge

Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

Appoint description: 
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 ab 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 ab and c (1 ≤ a, b, c ≤ 100).

Output

Print a single integer — the required sum modulo 1073741824(230).

Sample Input

Input
  1. 2 2 2
Output
  1. 20
Input
  1. 5 6 7
Output
  1. 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,暴力就行,直接由于因子个数等于质因子的系数加一之积,反素数讲过,由此可得;

代码:

  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<math.h>
  4. #include<algorithm>
  5. #include<iostream>
  6. #include<set>
  7. #define ll long long
  8. #define MOD 1073741824
  9. using namespace std;
  10. int num[];
  11. int main()
  12. {
  13. int a,b,c;
  14. int i,j,k;
  15. while(scanf("%d%d%d",&a,&b,&c)!=EOF)
  16. {
  17. memset(num, , sizeof(num));
  18. ll sum=, temp;
  19. set<int>st;
  20. set<int>::iterator iter;
  21. for(i=;i<=a;i++)
  22. {
  23. for(j=;j<=b;j++)
  24. {
  25. for(k=;k<=c;k++)
  26. {
  27. temp = i * j * k;
  28. ll cnt = ;
  29. for(int p = ; p <= temp; p++){
  30. if(temp % p == ){
  31. int cur = ;
  32. while(temp % p == ){
  33. temp /= p;
  34. cur++;
  35. }
  36. cnt *= cur + ;
  37. }
  38. }
  39. sum += cnt;
  40. sum %= MOD;
  41. }
  42. }
  43. }
  44.  
  45. printf("%lld\n",sum);
  46. }
  47. return ;
  48. }

Easy Number Challenge(暴力,求因子个数)的更多相关文章

  1. 『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 ...

  2. Trailing Zeroes (I) LightOJ - 1028(求因子个数)

    题意: 给出一个N 求N有多少个别的进制的数有后导零 解析: 对于一个别的进制的数要转化为10进制 (我们暂且只分析二进制就好啦) An * 2^(n-1) + An-1 * 2^(n-2) + `` ...

  3. Almost All Divisors(求因子个数及思维)

    ---恢复内容开始--- We guessed some integer number xx. You are given a list of almost all its divisors. Alm ...

  4. LightOj1028 - Trailing Zeroes (I)---求因子个数

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1028 题意:给你一个数 n (1<=n<=10^12), 然后我们可以把它 ...

  5. POJ 2992 Divisors (求因子个数)

    题意:给n和k,求组合C(n,k)的因子个数. 这道题,若一开始先预处理出C[i][j]的大小,再按普通方法枚举2~sqrt(C[i][j])来求解对应的因子个数,会TLE.所以得用别的方法. 在说方 ...

  6. Number of Parallelograms(求平行四边形个数)

    Number of Parallelograms time limit per test 4 seconds memory limit per test 256 megabytes input sta ...

  7. 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, ...

  8. BZOJ3994:约数个数和(莫比乌斯反演:求[1,N]*[1,M]的矩阵的因子个数)

    Description  设d(x)为x的约数个数,给定N.M,求   Input 输入文件包含多组测试数据. 第一行,一个整数T,表示测试数据的组数. 接下来的T行,每行两个整数N.M. Outpu ...

  9. Divisors (求解组合数因子个数)【唯一分解定理】

    Divisors 题目链接(点击) Your task in this problem is to determine the number of divisors of Cnk. Just for ...

随机推荐

  1. python高级编程之访问超类中的方法:super()

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' #超类01 #它是一个内建类型,用于访问属于某个对象超类特性 pri ...

  2. hdu 2822 Dogs(优先队列)

    题目链接:hdu2822 会优先队列话这题很容易AC.... #include<stdio.h> #include<string.h> #include<queue> ...

  3. oracle开启/关闭归档模式

    1.改变非归档模式到归档模式: 1)SQL> conn / as sysdba (以DBA身份连接数据库) 2)SQL> shutdown immediate;(立即关闭数据库) 3)SQ ...

  4. attr()和prop()的区别

    引用以为一位大神的文章: http://www.365mini.com/page/jquery-prop.htm http://www.365mini.com/page/jquery-attr-vs- ...

  5. 提示框的优化之自定义Toast组件之(三)Toast组件优化

    开发步骤: 在toast_customer.xml文件中添加一个图片组件对象显示提示图片 <?xml version="1.0" encoding="utf-8&q ...

  6. const用法总结

    1. const修饰变量 ; const int* a = &b; //情况1 int const* a = &b; //情况2 int* const a = &b; //情况 ...

  7. asp.net mvc 访问.html文件

    把html页面放在除Views文件夹外的任意文件夹,如Htmls--123.html,url直接访问便可,如 http://yourname/htmls/123.html 可以在路由表中排出不需要路由 ...

  8. C#实现在线更新系统

    先来看一下程序完成后长什么样. 这个是程序的组成部分. 主要功能是在InitializationUpdate这个类中完成的,From1主要起到调用的作用,所以重心还是在InitializationUp ...

  9. 8、Khala的设备间管理+通信

    在之前的文档中,我们都是从单个设备的角度进行介绍,但在实际业务中,不同设备间存在交互行为.我们经常需要在一个设备的生命周期中查询另一个设备信息,或者向另一个设备进行通信.因此我们提供了设备管理模块来对 ...

  10. JavaScript数组知识网络

    JavaScript数据类型 基本数据类型 Boolean Null Number String Symbol Undefined 对象数据类型Object Build-in object Array ...