提交记录 33190


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 1000f. 测测你的实数 A+B Wrong Answer 0 2.66 us 12 KB C++ 2.39 KB
提交时间 评测时间
2026-08-14 21:49:13 2026-08-14 21:49:18
// 1000f: read stdin, compute sums, write 10 doubles to OB
#include <stdint.h>
struct DuckInfo {
    unsigned long abi; const char *stdin_ptr; unsigned long stdin_size;
    char *stdout_ptr; unsigned long stdout_limit; unsigned long stdout_size;
    char *stderr_ptr; unsigned long stderr_limit; unsigned long stderr_size;
    const char *IB_ptr; unsigned long IB_limit; char *OB_ptr; unsigned long OB_limit;
    unsigned long tsc;
} __attribute__((packed));

static const double POW10P[23] = {1e0,1e1,1e2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17,1e18,1e19,1e20,1e21,1e22};
static const double POW10N[23] = {1e0,1e-1,1e-2,1e-3,1e-4,1e-5,1e-6,1e-7,1e-8,1e-9,1e-10,1e-11,1e-12,1e-13,1e-14,1e-15,1e-16,1e-17,1e-18,1e-19,1e-20,1e-21,1e-22};

static const char* P;
static double parse_double() {
    const char *p = P;
    while (*p==' '||*p=='\t'||*p=='\n'||*p=='\r'||*p=='\v'||*p=='\f') p++;
    int neg = 0;
    if (*p=='+') p++; else if (*p=='-') { neg=1; p++; }
    unsigned long long mant = 0; int exp10 = 0, dot = 0;
    for (;;) {
        unsigned char c = (unsigned char)*p;
        if (c>='0'&&c<='9') { if (mant < 1000000000000000000ULL) { mant = mant*10 + (c-'0'); if (dot) exp10--; } p++; }
        else if (c=='.' && !dot) { dot=1; p++; }
        else break;
    }
    if (*p=='e'||*p=='E') { p++; int es=1; if (*p=='+') p++; else if (*p=='-'){es=-1;p++;} int e=0; while(*p>='0'&&*p<='9'){e=e*10+(*p-'0');p++;} exp10 += es*e; }
    P = p;
    double v = (double)mant;
    if (exp10>0) { if (exp10<=22) v*=POW10P[exp10]; else v*=POW10P[22]; }
    else if (exp10<0) { int k=-exp10; if (k<=22) v*=POW10N[k]; else v*=POW10N[22]; }
    return neg ? -v : v;
}

double plus(double a, double b) { return a + b; }

extern "C" void __libc_start_main(int (*mf)(int, char**, char**), int ac, char **av,
                                   void *x, void *y, void *z) {
    (void)mf;(void)ac;(void)x;(void)y;(void)z;
    unsigned long *q = (unsigned long*)&av[ac + 1];
    while (*q) q++; q++;
    struct DuckInfo *d = 0;
    while (q[0]) { if (q[0] == 0x6b637564) { d = (struct DuckInfo*)q[1]; break; } q += 2; }
    P = d->stdin_ptr;
    double *o = (double*)d->OB_ptr;
    for (int i = 0; i < 10; i++) {
        double a = parse_double();
        double b = parse_double();
        o[i] = a + b;
    }
    __asm__ volatile("mov $60,%%rax; xor %%rdi,%%rdi; syscall" ::: "rax","rdi","memory");
    __builtin_unreachable();
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.66 us12 KBWrong AnswerScore: 0


Judge Duck Online | 评测鸭在线
Server Time: 2026-09-11 04:00:48 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠