/*
argv[1]:输入文件
argv[2]:选手输出文件
argv[3]:标准输出文件
argv[4]:单个测试点分值
argv[5]:输出最终得分的文件
argv[6]:输出错误报告的文件
*/
#include<bits/stdc++.h>
int n,k,a[100100];
using namespace std;
void out_false1();
void out_false2();
void out_ok();
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");//错误信息
fscanf(f_stdin,"%d%d",&n,&k);
int i;
for (i=1;i<=n;i++) fscanf(f_stdin,"%d",&a[i]);
int x,y;bool ok=1;
while (fscanf(f_out,"%d%d",&x,&y)!=EOF)
{
if (a[y]<a[x]) {ok=0;break;}
a[y]-=a[x];a[x]+=a[x];
}
if (!ok) {fprintf(f_wrong,"Wrong Answer");fprintf(f_score,"0");}
else
{
int pos=0;
for (i=1;i<=n;i++)
{
if (a[i])
{
if (pos==0) pos=i;else {ok=0;break;}
}
}
if (ok) fprintf(f_score,"10");
else {fprintf(f_wrong,"Wrong Answer");fprintf(f_score,"0");}
}
return 0;
}
原文地址:https://www.cnblogs.com/zhou2003/p/9858881.html
时间: 2024-10-23 05:25:55