[原创]9.8日标程&测试数据
数据:
data.c
#include<stdio.h>
int main(void)
{
char s[1001]={0};
int i;
int n,temp;
int max=0,min=1001,sum=0;
FILE *input,*output;
input=fopen("data.in","r");
output=fopen("data.out","w");
fscanf(input,"%d",&n);
for(i=0;i<n;i++)
{
fscanf(input,"%d",&temp);
if(!s[temp])
{
s[temp]=1;
sum+=temp;
if(temp>max) max=temp;
if(temp<min) min=temp;
}
else { i--; n--; }
}
fprintf(output,"%d\n",n);
for(i=0;i<1001;i++) if(s[i]) fprintf(output,"%d ",i);
fprintf(output,"\n%d %d",max-min,sum/n);
fclose(input);
fclose(output);
return 0;
}
[此贴子已经被作者于2007-9-8 22:56:36编辑过]