终于看懂了百度百科,(⊙o⊙)…
存一份代码
#include //cena
#define LL long long
using namespace std;
FILE *f_score,*f_stdout,*f_stdin,*f_out,*f_wrong;
int main(int argc,char*argv[])
{
f_score=fopen("score.log","w");//打开得分文件
f_stdout=fopen(argv[2],"r");//打开测试点标准输出文件
int score=atoi(argv[1]);//取得测试点的分数
f_stdin=fopen("math.in","r");//原始数据
f_out=fopen("math.out","r");//用户输出
f_wrong=fopen("report.log","w");//打开报告文件
int a,b;
fscanf(f_stdin,"%d%d",&a,&b);
int ans;
fscanf(f_out,"%d",&ans);
if(abs(a+b-ans)<=2)
f_printf(f_sorce,"10");
else
f_printf(f_sorce,"0");
return 0;
}
#include //lemon
#include
#include
#define LL long long
using namespace std;
struct P{int x,y;}p[1005];
LL dis[1005][1005];
LL f(int x)
{return (LL)x*(LL)x;}
bool use[1005];
int main(int argc,char **argv)
{
FILE *f_stdin=fopen(argv[1],"r");//标准输入
FILE *f_out=fopen(argv[2],"r");//选手输出
FILE *f_stdout=fopen(argv[3],"r");//标准输出
FILE *f_score=fopen(argv[5],"w");//分数输出
FILE *f_wrong=fopen(argv[6],"w");//错误信息
int n,k;
fscanf(f_stdin,"%d%d",&n,&k);
for(int i=1;i<=n;i++)
fscanf(f_stdin,"%d%d",&p[i].x,&p[i].y);
for(int i=1;ifor(int j=i+1;j<=n;j++)
dis[i][j]=f(p[i].x-p[j].x)+f(p[i].y-p[j].y);
int x;
for(int i=1;i<=k;i++)
{
fscanf(f_stdout,"%d",&x);
use[x]=1;
}
LL Max=0;
for(int i=1;ifor(int j=i+1;j<=n;j++)
if(dis[i][j]>Max&&!use[i]&&!use[j])
Max=dis[i][j];
int tot=0;
memset(use,0,sizeof(use));
bool b=0;
while(fscanf(f_out,"%d",&x)!=EOF)
{
tot++;
if(x<=0||x>n)
{b=1;break;}
use[x]++;
}
if(tot!=k)
{
fprintf(f_score,"0");
if(b) fprintf(f_wrong,"输出错误");
else{
if(totfprintf(f_wrong,"输出过短");
if(tot>k) fprintf(f_wrong,"输出过长");
}
return 0;
}
LL Ans=0;
for(int i=1;ifor(int j=i+1;j<=n;j++)
if(dis[i][j]>Ans&&!use[i]&&!use[j])
Ans=dis[i][j];
if(Ans==Max&&tot==k)
fprintf(f_score,"10");
else
{
fprintf(f_score,"0");
if(tot==k&&Ans!=Max)
fprintf(f_wrong,"答案错误");
}
}