zoukankan      html  css  js  c++  java
  • [AHOI 2005]COMMON 约数研究

    Description

    Input

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

    Output

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

    Sample Input

    3

    Sample Output

    5

    题解

    水题一道...做不出的要$AFO$了...

     1 //It is made by Awson on 2017.11.10
     2 #include <map>
     3 #include <set>
     4 #include <cmath>
     5 #include <ctime>
     6 #include <queue>
     7 #include <stack>
     8 #include <cstdio>
     9 #include <string>
    10 #include <vector>
    11 #include <cstdlib>
    12 #include <cstring>
    13 #include <iostream>
    14 #include <algorithm>
    15 #define LL long long
    16 #define LD long double
    17 #define Max(a, b) ((a) > (b) ? (a) : (b))
    18 #define Min(a, b) ((a) < (b) ? (a) : (b))
    19 #define sqr(x) ((x)*(x))
    20 #define y1 yy
    21 #define count COUNT
    22 #define Lr(o) (o<<1)
    23 #define Rr(o) (o<<1|1)
    24 using namespace std;
    25 const int N = 1000000;
    26 
    27 int n;
    28 LL ans;
    29 
    30 void work() {
    31     scanf("%d", &n);
    32     for (int i = 1; i <= n; i++)
    33     ans += n/i;
    34     printf("%lld
    ", ans);
    35 }
    36 int main() {
    37     work();
    38     return 0;
    39 }
  • 相关阅读:
    Hypercall机制
    python 基础-----数字,字符串,if while 循环 数据类型的转换简单介绍
    计算机基础知识
    Proxmox初步了解
    Centos7-安装py3
    KVM-virsh常用命令
    Centos7-VNC安装
    Centos7-bond模式介绍
    KVM管理工具
    Win10-无法启动虚拟机
  • 原文地址:https://www.cnblogs.com/NaVi-Awson/p/7857320.html
Copyright © 2011-2022 走看看