zoukankan      html  css  js  c++  java
  • ZZNU 正约数之和

    #include<stdio.h>
    #include<string.h>
    #include<math.h>
    #include<time.h>
    #include<iostream>
    #include<ctype.h>
    #include<map>
    #include<set>
    #include<string>
    #include<vector>
    #include<algorithm>
    #include<stdlib.h>
    #include<queue>
    #include<stack>
    using namespace std;
    const int A=1000001;
    long long n,m;
    long long f[1000001];
    void da()
    {   int i,j;
    memset(f,0,sizeof(f));
        for(i=1;i<=A;i++)
        {
            for(j=i;j<=A;j+=i)
            {
                f[j]+=i;
            }
            f[i]+=f[i-1];
        }
    }
    int main()
    {
        int t,k;
        da();
        scanf("%d",&t);
        while(t--)
        {
            scanf("%d",&k);
            printf("%lld
    ",f[k]);
        }
    }
  • 相关阅读:
    h5-7
    h5-6
    h5-5
    h5-4
    h5-3
    h5-2
    return
    字符串的常用操作
    字符串中的转义字符
    字典的统计,合并,清空操作
  • 原文地址:https://www.cnblogs.com/nr1999/p/9031213.html
Copyright © 2011-2022 走看看