- #include <stdio.h>
- typedef long long LL;
- void solve() {
- LL n,ans = 0;
- LL i,j;
- scanf("%lld",&n);
- for (i = 2; i * i <= n; ++i) {
- j = n / i;
- ans += (i + j) * (j - i + 1) / 2;
- ans += i * (j - i);
- }
- printf("%lld\n", ans);
- }
- int main() {
- int tc;
- scanf("%d",&tc);
- for (int i = 0; i < tc; ++i) {
- printf("Case %d: ", i + 1);
- solve();
- }
- return 0;
- }
Friday, 28 July 2017
Lightoj 1098 - A New Function
Subscribe to:
Post Comments (Atom)
Most Featured Post
Lightoj 1159 - Batman
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
-
http://lightoj.com/volume_showproblem.php?problem=1382 Problem analysis: This is a rare problem i wrote about so far. After much strugg...
-
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
No comments:
Post a Comment