ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1223. Chernobyl’ Eagle on a Roof

Why WA1?
Posted by ivan.filippov201608@gmail.com 3 Nov 2021 00:00
pls give me some tests,i don't know,what's wrong with my code
#include<iostream>


#define  endl '\n'
#define ll long long
# define ld long double
using namespace std;

ll d[1100][1100];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef LOCAL
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif // LOCALfr

int n,m;


            for (int i=1;i<=1000;i++) {
    for (int j=1;j<=1000;j++) {
        d[i][j] = d[i][j-1] + d[i - 1][j - 1] + 1;
    }
            }
n=1;m=1;
while (n && m) {
    cin>>n>>m;
    if (n &&m) {
        int l=1,r=m+1000,mi;
        while (l<r) {
            mi=(l+r)/2;
            if (d[n][mi]>=m) {
                r=mi;
            }
            else l=mi+1;
        }
        cout<<l<<endl;
    }
}
    return 0;
}

Edited by author 03.11.2021 00:01

Edited by author 03.11.2021 00:01

Edited by author 03.11.2021 00:01