Просмотр исходного кода Задача: 4 Время: 14:14:13 5-10-14 Язык: Visual C/C++ 2010 #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); int n, k, s; cin >> n >> k >> s; vector ans; for (int i = 1; i <= k; ++i) { int x = i; if (s - x >= n - 1 && s - x <= (n - 1) * k) ans.push_back(x); } if (ans.size() == 1) { cout << ans[0] << " " << ans[0] << " " << ans[0] << " " << ans[0] << endl; return 0; } else { int a, b = 0, c = (int)1e8, d; a = ans[0]; d = ans[ans.size() - 1]; int treshold = k / 2 + (k % 2); if (ans.size() != 3) { b = ans[ans.size() / 2 - 1]; c = ans[ans.size() / 2]; } else { b = ans[ans.size() / 2]; c = ans[ans.size() / 2]; } /*for (int i = 0; i < ans.size(); ++i) { if (ans[i] < treshold) b = max(b, ans[i]); else if (ans[i] == treshold) { b = max(b, ans[i]); if (s - 2 * ans[i] >= n - 2 && s - 2 * ans[i] <= (n - 2) * k) c = min(c, ans[i]); } else c = min(c, ans[i]); }*/ cout << a << " " << b << " " << c << " " << d << endl; } return 0; }