设为首页 加入收藏

TOP

B. Easy Number Challenge
2015-07-20 17:37:21 来源: 作者: 【 】 浏览:3
Tags:Easy Number Challenge
B. Easy Number Challenge

time limit per test 2 seconds
memory limit per test 256 megabytes



题目链接:传送门

Let's denote d(n) as the number of divisors of a positive integern. 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 integersa, b andc (1?≤?a,?b,?c?≤?100).

Output

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

Sample test(s) Input
2 2 2
Output
20
Input
5 6 7
Output
1520
Note

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.


意解:暴力,先把暴力枚举一边,记录每个数出现的个数,然后Nsqrt(N)找因子;


AC代码:

#include 
  
   
#include 
   
     #include 
    
      #include 
     
       #define For(i,a,n) for(int i = a; i <= n; i++) using namespace std; const int M = 1e6; const int INF = 1LL << 30; int ma[M + 10]; int main() { int a,b,c; int ans = 0; scanf("%d %d %d",&a,&b,&c); For(i,1,a) For(j,1,b) For(k,1,c) ma[i * j * k]++; for(int i = 1; i <= M; i++) { if(ma[i]) for(int p = 1; p * p <= i; p++) { if(i % p == 0) { ans += ma[i]; if(p * p != i) ans += ma[i]; } } } cout<
      
       

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇poj1195--Mobile phones(二维树状.. 下一篇HDU 3306 Another kind of Fibona..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·利用python进行数据 (2025-12-25 20:49:22)
·如何使用 python 中 (2025-12-25 20:49:19)
·零基础如何学爬虫技 (2025-12-25 20:49:17)
·Java 并发工具类:提 (2025-12-25 20:25:44)
·Java面试技巧:如何 (2025-12-25 20:25:41)