#line 1 "sqrt.test.cpp" #define PROBLEM "https://yukicoder.me/problems/no/1162" #line 1 "/workspaces/Aice/Src/Integer/Util.hpp" #line 1 "/workspaces/Aice/Src/Primitive/TypeDef.h" #include using s32 = int_fast32_t; using s64 = int_fast64_t; using u32 = uint_fast32_t; using u64 = uint_fast64_t; using f32 = float; using f64 = double; using f128 = long double; #line 5 "/workspaces/Aice/Src/Integer/Util.hpp" #include #include namespace aice { namespace integer { class Util { public: /** * sqrt(target)以下の最大の整数を計算します * @param target 平方数を計算したい値。0以上である必要があります */ template static T sqrt_floor(T target) { assert(target >= 0); T cand = std::sqrt(target); while (cand * cand > target) cand--; while ((cand + 1) * (cand + 1) <= target) cand++; return cand; } }; } } #line 4 "sqrt.test.cpp" #include int main() { s64 X; std::cin >> X; s64 sqrt_X = aice::integer::Util::sqrt_floor(X); s64 ans = sqrt_X * 2LL; if (X / sqrt_X == sqrt_X) ans--; std::cout << ans << std::endl; }