Accepted
Code
#include <bits/stdc++.h>
#define int long long
#define endll '\n';
#define pb push_back
#define all(v) v.begin(), v.end()
using namespace std;
const int mod = 1e9 + 7, N = 1e6;
unordered_map<int, int> vis;
void solve()
{
vis.clear();
int n, k;
int ans = 0;
cin >> n >> k;
int z = k / n;
z = (z + 1) / 2;
if (k - z * n >= 0)
ans = z * (k - (z * n));
cout << ans << endll;
}
int32_t main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int t = 1;
cin >> t;
while (t--)
{
solve();
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1092 Bitwise AND
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-09-08 15:51:33
- Judged At
- 2024-11-11 02:54:38
- Judged By
- Score
- 100
- Total Time
- 28ms
- Peak Memory
- 2.238 MiB