Accepted
Code
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int t;
cin >> t;
while (t--){
ll n, k;
cin >> n >> k;
if (n >= k){
cout << 0 << endl;
continue;
}
ll x = k / n;
ll p = x / 2, q = (x + 1) / 2;
ll mx = p * (k - (n * p));
mx = max(mx, q * (k - (n * q)));
cout << mx << endl;
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1092 Bitwise AND
- Contest
- Brain Booster #5
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-09-05 16:13:40
- Judged At
- 2024-11-11 03:01:20
- Judged By
- Score
- 100
- Total Time
- 268ms
- Peak Memory
- 2.328 MiB