QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#496833#9136. Exponent Calculatorucup-team4361#AC ✓0ms4164kbC++142.0kb2024-07-28 16:24:042024-07-28 16:24:04

Judging History

你现在查看的是最新测评结果

  • [2024-07-28 16:24:04]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:4164kb
  • [2024-07-28 16:24:04]
  • 提交

answer

#include <bits/stdc++.h>

#define LL long long
#define ull unsigned long long
#define F(i, j, k) for (int i = j; i <= k; ++i)
#define DF(i, j, k) for (int i = j; i >= k; --i)

using namespace std;

template <typename T> inline void read(T &n) {
    T w = 1;
    n = 0;
    char ch = getchar();
    while (!isdigit(ch) && ch != EOF) {
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (isdigit(ch) && ch != EOF) {
        n = (n << 3) + (n << 1) + (ch & 15);
        ch = getchar();
    }
    n *= w;
}

template <typename T> inline void write(T x) {
    T l = 0;
    ull y = 0;
    if (!x) { putchar(48); return; }
    if (x < 0) { x = -x; putchar('-'); }
    while (x) { y = y * 10 + x % 10; x /= 10; ++l; }
    while (l) { putchar(y % 10 + 48); y /= 10; --l; }
}

template <typename T> inline void writes(T x) {
    write(x);
    putchar(' ');
}

template <typename T> inline void writeln(T x) {
    write(x);
    puts("");
}

template <typename T> inline void checkmax(T &a, T b) { a = a > b ? a : b; }

template <typename T> inline void checkmin(T &a, T b) { a = a < b ? a : b; }

const double t = -20;

int main() {
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    cout << 25 << '\n';
    double x = 1;
    F(i, 1, 17) x = x * 0.5;
    cout << fixed << setprecision(17) << "$1 = $1 * " << x << '\n';
    cout << "$2 = $1 * $1\n";
    cout << "$2 = $2 * 0.5\n";
    cout << "$3 = $2 * $1\n";
    cout << "$3 = $3 * " << fixed << setprecision(16) << 1.0 / 3 << '\n';
    double now = pow(x * (t), 3) * 1.0 / 6 + x * (t) * x * (t) * 0.5 + x * (t) + 1;

    cout << "$0 = $1 + 1.0\n";
    cout << "$0 = $0 + $2\n";
    cout << "$0 = $0 + $3\n";
    F(i, 1, 17) {
        cout << "$0 = $0 * $0\n";
        now *= now;
    }
    //cout << fixed << setprecision(20) << now << ' ' << exp(t) << '\n';
    //cout << fixed << setprecision(20) << fabs(now - exp(t)) / exp(t) << '\n';
    //assert(fabs(now - exp(t)) / exp(t) <= 1e-9);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4164kb

input:

input

output:

25
$1 = $1 * 0.00000762939453125
$2 = $1 * $1
$2 = $2 * 0.5
$3 = $2 * $1
$3 = $3 * 0.3333333333333333
$0 = $1 + 1.0
$0 = $0 + $2
$0 = $0 + $3
$0 = $0 * $0
$0 = $0 * $0
$0 = $0 * $0
$0 = $0 * $0
$0 = $0 * $0
$0 = $0 * $0
$0 = $0 * $0
$0 = $0 * $0
$0 = $0 * $0
$0 = $0 * $0
$0 = $0 * $0
$0 = $0 * $0
$0...

result:

ok max relative diff is 5.27578e-11. Checker runtime is 186 ms

Extra Test:

score: 0
Extra Test Passed