57.蝸牛翻牆

 avatar
user_6817964
c_cpp
2 years ago
409 B
1
Indexable
Never
#include <stdio.h>
int main()
{
    int a, b, c, d;
    int morning, night;
    scanf_s("%d%d%d%d", &a, &b, &c, &d);
    int index = 0, count = 0;
    while (index == 0) {
        morning = a - b - c;
        night = a - b - c + d;
        a = a - c + d;
        count++;
        if (morning <= 0)
            index = 1;
        else
            index = 0;
    }
    printf("%d", count);

}