-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1098 - A new function.cpp
61 lines (56 loc) · 1.18 KB
/
1098 - A new function.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* Author: Ashraful Islam Rafi
* University: Leading University,Sylhet
* url: http://www.lightoj.com/volume_showproblem.php?problem=1098
* problem id: 1098- A new function
* complexity: 2nd level(Number theory)
* site: Lightoj.com
**/
#include"map"
#include"set"
#include"queue"
#include"cmath"
#include"stack"
#include"ctype.h"
#include"cstdio"
#include"vector"
#include"cstdio"
#include"cstring"
#include"cstdlib"
#include"string.h"
#include"iostream"
#include"algorithm"
using namespace std;
#define cs "Case "<<++casee<<": "
#define csE "Case "<<++casee<<":\n"
#define Inf 1000000000
#define N 5000010
#define MST(a, tf) memset(a, tf, sizeof (a))
int main()
{
int t;cin>>t;int casee=0;unsigned long long sum=0;
while(t--)
{
sum=0;
unsigned long long int n;cin>>n;
unsigned long long sqr= (unsigned long long ) sqrt(n);
unsigned long long i,j,ans;
for(i=2;i<=sqr;i++)
{
ans=n/i;
sum += ((ans*(ans+1)/2) - ((i+1)* i/2) + (i*(ans-i+1)));
}
cout<<cs<<sum<<endl;
}
return 0;
}
///--test case--///
/**
3
2
100
200000000
Case 1: 0
Case 2: 3150
Case 3: 12898681201837053
*/