QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#175453#7102. Live Lovepengpeng_fudan#WA 0ms3444kbC++14814b2023-09-10 18:14:222023-09-10 18:14:23

Judging History

你现在查看的是最新测评结果

  • [2023-09-10 18:14:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3444kb
  • [2023-09-10 18:14:22]
  • 提交

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'