竞赛讨论区 > 为什么是sum*2-t*t呢?
头像
血小板自动机
发布于 2018-08-24 22:32
+ 关注

为什么是sum*2-t*t呢?

#include<cmath>
#include<cstdio>
#include<cstring>
usingnamespacestd;
typedef longlong ll;
intmain() {
    intq; scanf("%d", &q);
    while(q--) {
        intx; scanf("%d", &x);
        ll ans=0;
        intt=sqrt(x+1);
        for(inti=1; i<=t; ++i) ans+=(x/i);
        printf("%lld\n", ans*2-t*t);
    }
    return0;
}
这里的这句没太看懂,求dalao指点一下

全部评论

(3) 回帖
加载中...
话题 回帖

等你来战

查看全部

热门推荐