diff --git a/01xxx/01173.cpp b/01xxx/01173.cpp new file mode 100644 index 00000000..8270d5aa --- /dev/null +++ b/01xxx/01173.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; + +int solve(void) { + int N, m, M, T, R; cin >> N >> m >> M >> T >> R; + if (m + T > M) return -1; + + int ans = 0, cur = m; + while (N > 0) { + if (cur + T <= M) { + cur += T; + N--; + } else { + cur -= R; + if (cur < m) cur = m; + } + ans++; + } + return ans; +} + +int main(void) { + ios::sync_with_stdio(false); + cin.tie(nullptr); cout.tie(nullptr); + + cout << solve(); + return 0; +} \ No newline at end of file