Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <ext/pb_ds/assoc_container.hpp>
- #include <ext/pb_ds/tree_policy.hpp>
- //#define FILE 10
- #define int int64_t
- using namespace std;
- using namespace __gnu_pbds;
- template<typename T>
- using orset = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
- template<typename T, typename K>
- using ormap = tree <T, K, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
- mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());
- void solve()
- {
- int n, m, k;
- cin >> n >> m >> k;
- int now = n / m;
- int mod = n % m;
- vector <int> cnt (m);
- for (int i = 0; i < m; i++)
- cnt [i] = 0;
- for (int i = 1; i <= min(m, n); i++)
- {
- if (m == i)
- {
- cnt [0] = now;
- if (mod)
- {
- cnt [0]++;
- mod--;
- }
- continue;
- }
- cnt [i] = now;
- if (mod)
- {
- cnt [i]++;
- mod--;
- }
- }
- int sum = 0;
- int i = 0;
- for (; i < m; i++)
- {
- sum += cnt [i];
- if (sum >= k)
- break;
- }
- cout << i << "\n";
- }
- int32_t main(int32_t argc, char* argv[]) {
- ios::sync_with_stdio(false);
- cin.tie(0);cout.tie(0);
- #ifdef FILE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- int t = 1;
- //cin >> t;
- while (t--)
- solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment