#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long LL; template inline T& RD(T &x){ char c; for (c = getchar(); c < '0'; c = getchar()); x = c - '0'; for (c = getchar(); '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0'; return x; } const int inf = 0x3f3f3f3f; const int maxn = 100005; int ra[maxn]; int d[maxn]; int fa[maxn]; vector v[maxn]; int dfs(int u){ ra[u] = 0; for(int i=0;i i){ d[i] -= lft; if(d[i] < 0){ lft -= td; continue; } } cnt += d[i]/m; if(d[i]%m)cnt ++; lft = m - d[i]%m; if(lft == m)lft = 0; } printf("%d\n", cnt); } return 0; }