QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#558949#9136. Exponent Calculatorucup-team3691#AC ✓0ms3784kbC++231.4kb2024-09-11 19:26:072024-09-11 19:26:10

Judging History

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

  • [2024-09-11 19:26:10]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3784kb
  • [2024-09-11 19:26:07]
  • 提交

answer

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;

void solve() {
    ld x;
    cin >> x;
    cout << "25\n";
    cout << fixed << setprecision(16);
    cerr << fixed << setprecision(16);
    vector <ld> v(10);
    ld coeff = 1;
    for (int i = 0; i < 8; i++) {
        coeff /= 2;
    }
    cout << "$1 = $1 * " << coeff << '\n';
    x *= coeff;

    int start = 6;
    ld ans = x / start;
    cout << "$0 = $1 * " << (long double) 1/start << '\n';
    for (int i = start - 1; i >= 2; i--) {
        ans += 1;
        ans *= x;
        ans /= i;
        cout << "$0 = $0 + 1\n";
        cout << "$0 = $0 * $1\n";
        cout << "$0 = $0 * " << (long double) 1/i << '\n';
    }
    ans *= x;
    ans += x + 1;
    cout << "$0 = $0 * $1\n";
    cout << "$0 = $0 + $1\n";
    cout << "$0 = $0 + 1\n";
    for (int i = 0; i < 8; i++) {
        ans *= ans;
        cout << "$0 = $0 * $0\n";
    }
    //cerr << ans;
}

int main() {
#ifdef LOCAL
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int nrt = 1;
    //cin >> nrt;
    while (nrt--) {
        solve();
    }
    return 0;
}

详细

Test #1:

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

input:

input

output:

25
$1 = $1 * 0.0039062500000000
$0 = $1 * 0.1666666666666667
$0 = $0 + 1
$0 = $0 * $1
$0 = $0 * 0.2000000000000000
$0 = $0 + 1
$0 = $0 * $1
$0 = $0 * 0.2500000000000000
$0 = $0 + 1
$0 = $0 * $1
$0 = $0 * 0.3333333333333333
$0 = $0 + 1
$0 = $0 * $1
$0 = $0 * 0.5000000000000000
$0 = $0 * $1
$0 = $0 + ...

result:

ok max relative diff is 9.66167e-10. Checker runtime is 235 ms

Extra Test:

score: 0
Extra Test Passed