You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB

// SysY 运行库实现:
// - 按实验/评测规范提供 I/O 等函数实现
// - 与编译器生成的目标代码链接,支撑运行时行为
#include<stdio.h>
#include"sylib.h"
/* Input & output functions */
int getint(){int t; scanf("%d",&t); return t; }
int getch(){char c; scanf("%c",&c); return (int)c; }
int getarray(int a[]){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
return n;
}
void putint(int a){ printf("%d",a);}
void putch(int a){ printf("%c",a); }
void putarray(int n,int a[]){
printf("%d:",n);
for(int i=0;i<n;i++)printf(" %d",a[i]);
printf("\n");
}
float getfloat(){ float f; scanf("%f",&f); return f; }
void putfloat(float a){ printf("%a",a); }
int getfarray(float a[]){
int n; scanf("%d",&n);
for(int i=0;i<n;i++) scanf("%a",&a[i]);
return n;
}
void putfarray(int n,float a[]){
printf("%d:",n);
for(int i=0;i<n;i++) printf(" %a",a[i]);
printf("\n");
}
static struct timeval _sysy_start, _sysy_end;
void starttime(){ gettimeofday(&_sysy_start, NULL); }
void stoptime(){
gettimeofday(&_sysy_end, NULL);
long us = (_sysy_end.tv_sec - _sysy_start.tv_sec) * 1000000L
+ (_sysy_end.tv_usec - _sysy_start.tv_usec);
fprintf(stderr, "Timer: %ldus\n", us);
}