結果
問題 | No.3072 Sum of sqrt(x) |
ユーザー | 👑 hos.lyric |
提出日時 | 2020-09-12 16:21:24 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,465 bytes |
コンパイル時間 | 3,436 ms |
コンパイル使用メモリ | 93,388 KB |
実行使用メモリ | 5,216 KB |
最終ジャッジ日時 | 2023-08-30 15:26:01 |
合計ジャッジ時間 | 103,516 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,504 KB |
testcase_01 | AC | 2 ms
4,384 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,384 KB |
testcase_05 | AC | 2 ms
4,384 KB |
testcase_06 | AC | 1 ms
4,384 KB |
testcase_07 | WA | - |
testcase_08 | AC | 542 ms
4,384 KB |
testcase_09 | AC | 872 ms
4,384 KB |
testcase_10 | AC | 1,997 ms
5,144 KB |
testcase_11 | TLE | - |
testcase_12 | AC | 1,980 ms
4,388 KB |
testcase_13 | AC | 1,979 ms
5,024 KB |
testcase_14 | AC | 1,978 ms
5,084 KB |
testcase_15 | AC | 1,975 ms
4,388 KB |
testcase_16 | AC | 1,974 ms
5,216 KB |
testcase_17 | TLE | - |
testcase_18 | AC | 1,979 ms
5,152 KB |
testcase_19 | AC | 1,998 ms
4,388 KB |
testcase_20 | AC | 1,989 ms
5,028 KB |
testcase_21 | AC | 1,959 ms
5,028 KB |
testcase_22 | AC | 1,966 ms
5,028 KB |
testcase_23 | AC | 1,976 ms
5,024 KB |
testcase_24 | AC | 1,991 ms
4,388 KB |
testcase_25 | AC | 1,975 ms
4,388 KB |
testcase_26 | AC | 1,990 ms
5,028 KB |
testcase_27 | AC | 1,895 ms
4,964 KB |
testcase_28 | WA | - |
testcase_29 | AC | 1,932 ms
5,028 KB |
ソースコード
#include <cassert> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <functional> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using Int = long long; template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; }; template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; } template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; } template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; } int main() { char buf[110]; int N; for (; ~scanf("%d", &N); ) { Int upp = 0; long double low = 0.0; for (int i = 0; i < N; ++i) { Int x; scanf("%lld", &x); if (x > 0) { /* sqrt(X[i]) - k = (X[i] - k^2) / (sqrt(X[i]) + k) */ const long double y = sqrtl((long double)x); const Int k = (Int)y; upp += k; low += (x - k * k) / (y + k); } sprintf(buf, "%.18Lf", upp + low); buf[18] = '\0'; puts(buf); } } return 0; }