Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define task "SX"
- #include <iostream>
- #include <cstdio>
- using namespace std;
- using ll = long long;
- using ld = long double;
- constexpr int N = 1e5 + 5;
- ll n, m, t;
- void Read()
- {
- cin >> n >> m >> t;
- }
- ll Get(int x)
- {
- return (n - x + 1) / m + 1;
- }
- void Solve()
- {
- ll cnt = 0, v = 0;
- for (int i = 1; i <= m; ++i)
- if (cnt + Get(i) >= t + 1)
- {
- v = i;
- break;
- }
- else
- cnt += Get(i);
- t = t + 1 - cnt;
- cout << (t - 1) * m + v - 1;
- }
- int32_t main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- if (fopen(task ".INP", "r"))
- {
- freopen(task ".INP", "r", stdin);
- freopen(task ".OUT", "w", stdout);
- }
- Read();
- Solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment