Atcoder ABC 139B

Atcoder ABC 139B

Meaning of the questions:

At first there were a jack, you have inserted row $ a $ jacks, you need $ b $ jacks, ask you how many Strip requires a minimum.

solution:

Violence simulation.

CODE:

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

#define LL long long
#define N 100010

LL a,b,ans;

int main() {
    scanf("%lld%lld",&a,&b);
    if(b == 1) {
        puts("0");
        return 0;
    }
    LL cnt = 1;
    while(true) {
        cnt = cnt + a - 1;
        ans++;
        if(cnt >= b) break;
    }
    printf("%lld",ans);
    //system("pause");
    return 0;
}

Guess you like

Origin www.cnblogs.com/Repulser/p/11449022.html