/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 2ms 532.0 KiB
#3 Accepted 3ms 532.0 KiB
#4 Accepted 3ms 532.0 KiB
#5 Accepted 4ms 408.0 KiB
#6 Accepted 28ms 580.0 KiB
#7 Accepted 268ms 1.711 MiB
#8 Accepted 263ms 1.637 MiB
#9 Accepted 264ms 1.715 MiB
#10 Accepted 249ms 2.328 MiB
#11 Accepted 245ms 2.039 MiB

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