#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define $ system("pause")
#define MOD (ll)10139
#define MAXN 200010
template<typename T> inline T smin(T &a, const T &b) { return a > b ? a = b : a; }
template<typename T> inline T smax(T &a, const T &b) { return a < b ? a = b : a; }
inline void add(ll &l, const ll &r) { l = (l + r) % MOD; }
ll gcd(ll v, ll u) { return u ? gcd(u, v % u) : v; }
ll po(ll v, ll u) { return u ? (po(v * v % MOD, u >> 1) * (u & 1 ? v : 1) % MOD) : 1; }
ll n, m, k;
ll answer[MAXN];
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> k >> m;
ll local = m / k;
ll local2 = local / (n - 1);
for (int i = 1; i < n; i++) {
answer[i] += k * ((local2 + 1) / 2);
}
for (int i = 2; i <= n; i++) {
answer[i] += k * (local2 / 2);
}
m -= local2 * (n - 1) * k;
if (local2 & 1) {
for (int i = n; m; i--) {
answer[i] += min(k, m);
m -= min(m, k);
}
}
else {
for (int i = 1; m; i++) {
answer[i] += min(k, m);
m -= min(m, k);
}
}
for (int i = 1; i <= n; i++)
cout << answer[i] << ' ';
//$;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
360 KB |
Output is correct |
3 |
Correct |
21 ms |
2448 KB |
Output is correct |
4 |
Correct |
32 ms |
2584 KB |
Output is correct |
5 |
Correct |
3 ms |
2584 KB |
Output is correct |
6 |
Correct |
3 ms |
2584 KB |
Output is correct |
7 |
Correct |
25 ms |
3232 KB |
Output is correct |
8 |
Correct |
20 ms |
3240 KB |
Output is correct |