B. easy number challenge

Source: Internet
Author: User
Time limit per test

2 seconds

Memory limit per test

256 megabytes

Input

Standard Input

Output

Standard output

Let's denoteD(N) As the number of divisors of a positive integerN.
You are given three IntegersA,BAndC.
Your task is to calculate the following sum:

Find the sum modulo 1073741824 (1, 230 ).

Input

The first line contains three space-separated IntegersA,BAndC(1 digit ≤ DigitA, Bytes,B, Bytes,CLimit ≤ limit 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) bytes = bytesD(1) Priority = Priority 1;
  • D(1 · 1 · 2) bytes = bytesD(2) Limit = Limit 2;
  • D(1 · 2 · 1) bytes = bytesD(2) Limit = Limit 2;
  • D(1 · 2 · 2) bytes = bytesD(4) Outputs = outputs 3;
  • D(2 · 1 · 1) bytes = bytesD(2) Limit = Limit 2;
  • D(2 · 1 · 2) bytes = bytesD(4) Outputs = outputs 3;
  • D(2 · 2 · 1) bytes = bytesD(4) Outputs = outputs 3;
  • D(2 · 2 · 2) bytes = bytesD(8) Limit = Limit 4.

So the result is 1 second + second 2 second + second 2 second + second 3 second + second 2 second + second 3 second + second 4 second = Second 20.

Problem description: This is to calculate the number of a number factor, create a table to find the number of each number factor, and add

#include <iostream>#include <cstdio>#include <cstdlib>#include <cmath>#include <cstring>#include <string>#include<set>#include <algorithm>using namespace std;int x[1000003];int main(){int a,b,c;int i,j,k,s=0;scanf("%d %d %d",&a,&b,&c);for(i=2;i<=1000002;++i){for( j=i;j<=1000002;j+=i)        {++x[j];}}for(i=1;i<=a;++i)    {for(j=1;j<=b;++j)        {for( k=1;k<=c;++k){s=(s+1+x[i*j*k])%1073741824;}}}printf("%d\n",s);return 0;} 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.