結果
問題 | No.1063 ルートの計算 / Sqrt Calculation |
ユーザー | kichi2004_ |
提出日時 | 2020-04-20 12:52:51 |
言語 | C++17(clang) (17.0.6 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 3,509 bytes |
コンパイル時間 | 1,115 ms |
コンパイル使用メモリ | 131,848 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 17:34:53 |
合計ジャッジ時間 | 1,817 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 2 ms
5,248 KB |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | AC | 2 ms
5,248 KB |
testcase_13 | AC | 2 ms
5,248 KB |
testcase_14 | AC | 2 ms
5,248 KB |
testcase_15 | AC | 2 ms
5,248 KB |
testcase_16 | AC | 2 ms
5,248 KB |
ソースコード
#include <iostream> #include <string> #include <vector> #include <iomanip> #include <numeric> #include <algorithm> //region region using std::cerr; using std::cin; using std::cout; using std::pair; using std::string; using std::vector; //endregion //region define/typedef #define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++) #define FORR(i, a, b) for (int(i) = (b); (i) >= (b); (i)--) #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep1(i, n) for (int(i) = 1; (i) <= (n); (i)++) #define repr(i, n) for (int(i) = (n)-1; (i) >= 0; (i)--) #define repr1(i, n) for (int(i) = (n); (i) > 0; (i)--) #define pb push_back #define mp std::make_pair #define mt std::make_tuple #define endl "\n" #define outif(b, t, f) cout << ((b) ? (t) : (f)) << endl #define bsort(vec) std::sort((vec).begin(), (vec).end()) #define rsort(vec) std::sort((vec).rbegin(), (vec).rend()) #define all(vec) (vec).begin(), (vec).end() #define even(i) (!(i & 1)) #define odd(i) (i & 1) #define sz(x) (int((x).size())) #define mset(v, n) std::memset((v), n, sizeof(v)) #define setminus(v) mset(v, -1) #define setzero(v) mset(v, 0) #define BIT(N) (1LL << (N)) using ll = long long; using lld = long double; using uint = unsigned int; using vint = vector<int>; using vlong = vector<ll>; using vstr = vector<string>; using pii = pair<int, int>; using pil = pair<int, ll>; using pll = pair<ll, ll>; using vpii = vector<pii>; using vpil = vector<pil>; using vpll = vector<pll>; //endregion //region methods/operator #pragma warning(disable : 6031) string to_string(const ll n) { std::stringstream ss; ss << n << std::flush; return ss.str(); } vector<string> split(const string &s, const string &delim) { vector<string> res; auto pos = 0; while (true) { const int found = s.find(delim, pos); if (found >= 0) { res.push_back(s.substr(pos, found - pos)); } else { res.push_back(s.substr(pos)); break; } pos = found + delim.size(); } return res; } template<typename T> string join(vector<T> &vec, const string &sep = " ") { size_t size = vec.size(); if (!size) return ""; std::stringstream ss; for (int i = 0; i < size - 1; i++) ss << vec[i] << sep; ss << vec[size - 1]; return ss.str(); } template<typename T> std::istream &operator>>(std::istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; } template<typename T> void print(T t) { cout << t << endl; } template<typename Iter> inline void print(const Iter &first, const Iter &last, const std::string &d = " ", bool endline = true) { cout << *first; for (Iter iter = first + 1; iter < last; ++iter) { cout << d << *iter; } if (endline) cout << "\n"; } constexpr ll powmod(ll a, ll b, ll p) { ll res = 1; while (b > 0) { if (b % 2) res = res * a % p; a = a * a % p; b >>= 1; } return res; } template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } //endregion //region initialize struct iii { iii() { cin.tie(nullptr); std::ios::sync_with_stdio(false); cout << std::fixed << std::setprecision(16); } } init; //endregion signed main() { int n; scanf("%d", &n); int a = 1, b = n; for (int i = 2; i * i <= n; ++i) { const int x = i * i; if (n % x) continue; a = i; b = n / x; } printf("%d %d", a, b); return 0; }