zoukankan      html  css  js  c++  java
  • BZOJ2721 [Violet 5]樱花

    先令n! = a:

    1 / x + 1 / y = 1 / a  =>  x = y * a / (y - a)

    再令 k = y - a:

    于是x = a + a ^ 2 / k  =>  k | a ^ 2

    故等价于求a ^2的约数个数

    素数筛一下什么的就好了嘛

     1 /**************************************************************
     2     Problem: 2721
     3     User: rausen
     4     Language: C++
     5     Result: Accepted
     6     Time:588 ms
     7     Memory:2408 kb
     8 ****************************************************************/
     9  
    10 #include <cstdio>
    11  
    12 using namespace std;
    13 typedef long long ll;
    14 const int N = 1000005;
    15 const int Cnt = 80005;
    16 const int mod = 1000000007;
    17  
    18 int n;
    19 bool F[N];
    20 int cnt, p[Cnt], c[Cnt];
    21 ll ans = 1;
    22  
    23 int main() {
    24     int i, j, t;
    25     scanf("%d
    ", &n);
    26     for (i = 2; i < N; ++i) {
    27         if (!F[i]) p[++cnt] = i;
    28         for (j = 1; j <= cnt && p[j] * i < N; ++j) {
    29             F[p[j] * i] = 1;
    30             if (p[j] % i == 0) break;
    31         }
    32     }
    33     for (i = 1; i <= cnt; ++i)
    34         for (j = p[i]; j <= n; j += p[i])
    35             for (t = j; t % p[i] == 0; t /= p[i]) ++c[i];
    36     for (i = 1; i <= cnt; ++i)
    37         (ans *= (c[i] << 1 | 1)) %= mod;
    38     printf("%lld
    ", ans);
    39     return 0;
    40 }
    View Code
    By Xs酱~ 转载请说明 博客地址:http://www.cnblogs.com/rausen
  • 相关阅读:
    响应式布局
    CSS3过渡
    CSS3背景
    CSS渐变
    CSS3选择器
    CSS3
    自定义指令
    键盘修饰符
    过滤器
    v-if与v-show区别
  • 原文地址:https://www.cnblogs.com/rausen/p/4138233.html
Copyright © 2011-2022 走看看