1 /* 2 贪心:每一次选取最多的线段,最大能放置nuts,直到放完为止,很贪婪! 3 题目读不懂多读几遍:) 4 */ 5 #include6 #include 7 #include 8 #include 9 using namespace std;10 11 const int MAXN = 1e3 + 10;12 const int INF = 0x3f3f3f3f;13 14 int main(void) //Codeforces Round #236 (Div. 2) A. Nuts15 {16 // freopen ("A.in", "r", stdin);17 18 int k, a, b, v;19 while (scanf ("%d%d%d%d", &k, &a, &b, &v) == 4)20 {21 int ans = 0;22 while (1)23 {24 int sec = 0;25 if (b >= k - 1) {b -= (k - 1); sec = k;}26 else if (b == 0) sec = 1;27 else {sec = b + 1; b = 0;}28 ans++;29 if (v * sec >= a) break;30 else a -= v * sec;31 }32 33 printf ("%d\n", ans);34 }35 36 return 0;37 }