/* * 本来想打表的,打着打着发现了一些数学规律。具体怎么证明嘛……🤷‍ */ #include #include constexpr size_t MAX_N = 10001; int get_ans(int n) { const int k = ceil(-0.5 + 0.5 * sqrt(4 * n + 1)); const bool extra = k * k < n; const int ans = k * (k - 1) + 1 + k * extra; return ans; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::cout << get_ans(n) << std::endl; return 0; }