提交记录 48317
| 提交时间 |
评测时间 |
| 2026-09-19 14:36:48 |
2026-09-19 14:36:49 |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define STEP(s) do{ const char*m=s; int n=0; while(m[n])n++; fake_write(m,n); }while(0)
static void fake_write(const char*b,int n){
// use DuckInfo to avoid stdio dependency for the marker
typedef unsigned long long u64;
struct DI { u64 abi; const char*in; u64 insz; char*out; u64 outlim; u64 outsz; char*err; u64 errlim; u64 errsz; const char*IB; u64 IBlim; char*OB; u64 OBlim; u64 tscfreq; } __attribute__((packed));
static DI* d=0;
if(!d){ char**env=environ; while(*env)env++; u64*p=(u64*)(env+1); for(;p[0];p+=2) if(p[0]==0x6b637564ULL) d=(DI*)p[1]; }
if(!d) return;
u64 off=d->outsz; if(off+n>d->outlim) n=d->outlim-off; if((long)n<=0)return;
for(int i=0;i<n;i++) d->out[off+i]=b[i]; d->outsz=off+n;
}
extern "C" char **environ;
static inline void raw_exit(int c){ register long rax __asm__("rax")=60; register long rdi __asm__("rdi")=c; __asm__ volatile("syscall"::"a"(rax),"D"(rdi):"rcx","r11","memory"); }
extern "C" int __libc_start_main(int (*main)(int,char**,char**), int argc, char **argv){
environ = argv+argc+1;
main(argc, argv, argv+argc+1);
STEP("|after-main");
raw_exit(0);
return 0;
}
int main(){
STEP("A");
volatile int x = strlen("hello");
STEP("B-strlen");
char buf[32]; strcpy(buf,"abc"); memcpy(buf+3,"def",4);
STEP("C-memcpy");
void*p = malloc(1000); STEP("D-malloc"); free(p); STEP("E-free");
int r = printf("printf:%d,%s\n", x, buf); STEP("F-printf");
{ FILE*f=fopen("/dev/null","w"); STEP("G-fopen"); if(f){fclose(f);STEP("H-fclose");} }
{ char*q = getenv("PATH"); STEP(q?"I-getenv":"I-getenv-null"); }
STEP("Z-done");
return 0;
}
| Compilation | N/A | N/A | Compile Error | Score: N/A | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-09-24 06:35:35 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠