HEU 4045 Divisor Summation

 1/**************************************
 2Problem: HEU 4045 Divisor Summation
 3Time: 0.6129 s
 4Memory: 2188 k 
 5Accepted Time: 2009-03-24 13:47:33
 6Tips: http://hi.baidu.com/networker05/blog/item/4065f11f0cd9ea0b314e15c1.html
 7**************************************/

 8#include <stdio.h>
 9int main()
10{
11    int a[500001= {0,0} ;
12    int i,j;
13    for(i=1;i<=250000;i++ )
14        for(j=2;i*j<= 500000;j++)
15            a[i*j]+= i ;
16    scanf("%d",&i) ;
17    while(i--)
18    {
19        scanf("%d",&j);
20        printf("%d\n",a[j]);
21    }

22    return 0 ;
23}

24
posted @ 2009-04-02 11:59  主函数  阅读(162)  评论(0编辑  收藏  举报