/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 2ms 324.0 KiB
#4 Accepted 1ms 532.0 KiB
#5 Accepted 2ms 580.0 KiB
#6 Accepted 4ms 576.0 KiB
#7 Accepted 28ms 1.816 MiB
#8 Accepted 28ms 1.473 MiB
#9 Accepted 28ms 1.707 MiB
#10 Accepted 26ms 2.238 MiB
#11 Accepted 28ms 2.188 MiB

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