/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 2ms 764.0 KiB
#3 Accepted 3ms 440.0 KiB
#4 Accepted 3ms 324.0 KiB
#5 Accepted 4ms 320.0 KiB
#6 Accepted 27ms 588.0 KiB
#7 Accepted 246ms 1.832 MiB
#8 Accepted 245ms 1.547 MiB
#9 Accepted 252ms 1.633 MiB
#10 Accepted 233ms 2.328 MiB
#11 Accepted 235ms 2.051 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-10-03 13:08:31
Judged By
Score
100
Total Time
252ms
Peak Memory
2.328 MiB