You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <cstdio>
|
|
int main()
|
|
{
|
|
int a, b, f, k, r, ans = 0;
|
|
for (scanf("%d%d%d%d", &a, &b, &f, &k), r = b; k--; f = a - f)
|
|
if (r < f || b < a - f)
|
|
return puts("-1"), 0;
|
|
else if (r >= a + (k ? a - f : 0))
|
|
r -= a;
|
|
else
|
|
ans++, r = b - a + f;
|
|
return printf("%d", ans), 0;
|
|
} |