Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- ios::sync_with_stdio(false);
- cin.tie(NULL); cout.tie(NULL);
- int n, v, z, t;
- cin >> n >> v >> z >> t;
- int Done[n];
- int nowV = t * -1;
- for(int x = 0; x < n; x++)
- {
- Done[x] = nowV + v;
- nowV = Done[x];
- if(Done[x] < 0)
- {
- Done[x] = 0;
- }
- }
- int nowZ = 0, time = 0;
- for(int x = 0; x < n; x++)
- {
- time += max(Done[x] - nowZ, 0);
- nowZ = max(Done[x], nowZ) + z;
- }
- cout << time;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement