Accepted
Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll tc;
cin>>tc;
while(tc--)
{
ll n,m;
cin>>n>>m;
ll l=0,r=m/n,ans=0;
while(l<=r)
{
ll mid=(l+(r-l)/2);
ll u=mid*n;
ll d=(m-(u));
ll g=d*mid;
if(d>=u)
{
ans=max(ans,g);
l=mid+1;
}
else
{
ans=max(ans,g);
r=mid-1;
}
}
cout<<ans<<endl;
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1092 Bitwise AND
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-09-06 14:05:15
- Judged At
- 2024-11-11 02:55:57
- Judged By
- Score
- 100
- Total Time
- 313ms
- Peak Memory
- 2.277 MiB