zoukankan      html  css  js  c++  java
  • BZOJ1968 [Ahoi2005]COMMON 约数研究

    Description

    Input

    只有一行一个整数 N(0 < N < 1000000)。

    Output

    只有一行输出,为整数M,即f(1)到f(N)的累加和。

    Sample Input

    3

    Sample Output

    5

    HINT

    Source

     
    正解:数学
    解题报告:
      讨论每个因子的贡献就可以了。
     
     1 //It is made by jump~
     2 #include <iostream>
     3 #include <cstdlib>
     4 #include <cstring>
     5 #include <cstdio>
     6 #include <cmath>
     7 #include <algorithm>
     8 #include <ctime>
     9 #include <vector>
    10 #include <queue>
    11 #include <map>
    12 #include <set>
    13 using namespace std;
    14 typedef long long LL;
    15 int n,ans;
    16 
    17 inline int getint()
    18 {
    19        int w=0,q=0; char c=getchar();
    20        while((c<'0' || c>'9') && c!='-') c=getchar(); if(c=='-') q=1,c=getchar(); 
    21        while (c>='0' && c<='9') w=w*10+c-'0', c=getchar(); return q ? -w : w;
    22 }
    23 
    24 inline void work(){
    25     n=getint(); for(int i=1;i<=n;i++) ans+=n/i; printf("%d",ans);
    26 }
    27 
    28 int main()
    29 {
    30   work();
    31   return 0;
    32 }
  • 相关阅读:
    数据科学 R语言速成
    F#周报2019年第29期
    F#周报2019年第28期
    F#周报2019年第27期
    F#周报2019年第26期
    F#周报2019年第25期
    F#周报2019年第24期
    F#周报2019年第23期
    .NET工程师的书单
    F#周报2019年第22期
  • 原文地址:https://www.cnblogs.com/ljh2000-jump/p/5870112.html
Copyright © 2011-2022 走看看