-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcalc.cpp
More file actions
37 lines (30 loc) · 663 Bytes
/
calc.cpp
File metadata and controls
37 lines (30 loc) · 663 Bytes
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
#include<bits/stdc++.h>
#define MAX 1000001
#define ll long long
#define DEBUG(x) do { std::cout << #x << ": " << x << " "; } while (0)
using namespace std;
int main()
{
//string str;
//char str[MAX];
ll int i,j,k,t,n,b;
cin>>t;
while(t--){
cin>>n>>b;
/*x=1;
k=0;
y=0;
for(i=2;i<=n;++i){
temp=(n-i)/b;
y= i+(temp-1)*i;
//DEBUG(i);DEBUG(y);
if(y>k)
k=y;
}
cout<<k<<endl;*/
ll int temp= round(n/(2.0*b));
ll x= (n-b*temp)*temp;
cout<<x<<endl;
}
return 0;
}