Runtime Error
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=u*d;
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
- P1093 Number of Ways (Easy version)
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-09-06 14:00:57
- Judged At
- 2024-11-11 02:55:58
- Judged By
- Score
- 0
- Total Time
- 1ms
- Peak Memory
- 580.0 KiB