| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
自己在程序中加了些测试代码,终于AC了!将前面的大虾的数据做成两个文件,然后再程序中读入,将自己的结果与他的相比发现了几组错误,修改后就AC了。
以下是加了测试的部分代码,给无限ac的同胞们参考下方法。
int main()
{
int i,sum,t1,t2;
ifstream in("data.txt");//前面的1000组测试数据,注意在文件末尾加上6个0,作为结束。
ifstream in2("result1.txt");//测试数据的结果
while(1)
{
for(i=1,sum=0;i<=6;i++)
{
// scanf("%d",&products[i]);
in>>products[i];//将测试数据从文件读入程序注 sum+=products[i];
}
if(!sum)break;
memset(pa,0,sizeof(pa));
// printf("%d\n",fn());
t1=fn();//自己的计算结果
in2>>t2;//前面的1000组数据结果
// out<<fn()<<endl;
if(t1!=t2)//做比较
{//将不相等的输出至屏幕
for(i=1;i<=6;i++)
cout<<products[i]<<' ';
cout<<endl;
cout<<t2<<' '<<t1<<endl;
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator