QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#175453 | #7102. Live Love | pengpeng_fudan# | WA | 0ms | 3444kb | C++14 | 814b | 2023-09-10 18:14:22 | 2023-09-10 18:14:23 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int read() {
int num=0;
char c=getchar();
while(c<'0'||c>'9') {
c=getchar();
}
while(c>='0'&&c<='9') {
num=num*10+c-'0';
c=getchar();
}
return num;
}
int n,m;
int check(int mid) {
int cnt=(m/mid)+(m%mid!=0);
if(m+(cnt-1)<=n) return 1;
return 0;
}
int binary() {
int l=1,r=m;
int mid,ans;
while(l<=r) {
mid=(l+r)>>1;
if(check(mid)) {
ans=mid;
r=mid-1;
} else l=mid+1;
}
return ans;
}
void solve() {
n=read();
m=read();
cout<<m<<" "<<binary()<<endl;
}
int main() {
int T=1;
T=read();
while(T--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3444kb
input:
5 5 4 100 50 252 52 3 0 10 10
output:
4 2 50 1 52 1 0 4 10 10
result:
wrong answer 4th lines differ - expected: '0 0', found: '0 4'