提交记录 175313


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_codex62a_agg6 noip17a. 【NOIP2017】小凯的疑惑 Accepted 100 3.41 us 8 KB C 2.23 KB
提交时间 评测时间
2026-11-18 22:58:06 2026-11-18 22:58:26
/* References
 * jiegec, https://duck.ac/submission/48022 , for applying the coprime
 * two-coin Frobenius formula and the idea of using the public stdio ABI.
 * JudgeDuck, https://github.com/JudgeDuck/JudgeDuck-OS/blob/master/inc/abi.hpp ,
 * for the public numeric ABI constants and standard-stream layout only.
 * The OS repository is GPL-3.0. This program independently implements the
 * interface, with no library or operating-system source copied or linked.
 * Approach and experiment
 * Find the active I/O descriptor through the auxiliary-vector tag. Parse each
 * operand within stdin_size and write the decimal answer directly from a small
 * reverse buffer. Measure the cost of the actual input-dependent computation. */
typedef unsigned long Word;
struct Streams {
    Word version;
    const char *input;
    Word size;
    char *output;
    Word capacity;
    Word written;
};
static inline __attribute__((noreturn)) void finish(int code){
    __asm__ volatile ("syscall" : : "a"(60UL), "D"((long)code) : "rcx","r11","memory");
    __builtin_unreachable();
}
static int solve(const char *,Word,char *,Word);
int main(void){return 0;}
__attribute__((noreturn)) void __libc_start_main(void *unused,int argc,char **argv){
    (void)unused;
    char **environment=argv+argc+1;
    while(*environment) ++environment;
    const Word *record=(const Word *)(environment+1);
    while(record[0] && record[0]!=0x6b637564UL) record+=2;
    if(!record[0]) finish(1);
    struct Streams *io=(struct Streams *)record[1];
    int n=solve(io->input,io->size,io->output,io->capacity);
    if(n<0 || (Word)n>io->capacity) finish(1);
    io->written=(unsigned)n;
    finish(0);
}
static Word number(const char **cursor,const char *end) {
    const char *p=*cursor;
    while(p!=end && (unsigned)(*p-'0')>9) ++p;
    Word n=0;
    while(p!=end && (unsigned)(*p-'0')<=9) n=n*10+(*p++-'0');
    *cursor=p;
    return n;
}
static int solve(const char *p,Word size,char *out,Word capacity){
    const char *end=p+size;
    Word a=number(&p,end),b=number(&p,end),r=(a-1)*(b-1)-1;
    char tmp[24]; unsigned len=0;
    do {tmp[len++]=(char)('0'+r%10);r/=10;}while(r);
    if(len+1>capacity) return -1;
    for(unsigned i=0;i<len;++i) out[i]=tmp[len-i-1];
    out[len]='\n';
    return len+1;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.71 us8 KBAcceptedScore: 5

Testcase #23.09 us8 KBAcceptedScore: 5

Testcase #32.74 us8 KBAcceptedScore: 5

Testcase #42.58 us8 KBAcceptedScore: 5

Testcase #52.56 us8 KBAcceptedScore: 5

Testcase #62.68 us8 KBAcceptedScore: 5

Testcase #73.35 us8 KBAcceptedScore: 5

Testcase #82.89 us8 KBAcceptedScore: 5

Testcase #92.51 us8 KBAcceptedScore: 5

Testcase #102.54 us8 KBAcceptedScore: 5

Testcase #112.54 us8 KBAcceptedScore: 5

Testcase #122.19 us8 KBAcceptedScore: 5

Testcase #133.33 us8 KBAcceptedScore: 5

Testcase #143.41 us8 KBAcceptedScore: 5

Testcase #152.65 us8 KBAcceptedScore: 5

Testcase #163.02 us8 KBAcceptedScore: 5

Testcase #173.02 us8 KBAcceptedScore: 5

Testcase #182.96 us8 KBAcceptedScore: 5

Testcase #192.89 us8 KBAcceptedScore: 5

Testcase #202.4 us8 KBAcceptedScore: 5


Judge Duck Online | 评测鸭在线
Server Time: 2026-11-26 06:39:19 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠