八中OJ的SPJ模板
RT.
#include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<algorithm> using namespace std; #define OJ_AC 0 #define OJ_WA 1 #define OJ_PE 5 #define eps 1e-6 double out[1010],ans[1010]; int main(int argc,char*argv[]){ FILE*fin,*fans,*fout; fin=fopen(argv[1],"r"); fans=fopen(argv[2],"r"); fout=fopen(argv[3],"r"); int n,i,j; fscanf(fin,"%d",&n); for(i=1;i<=n;++i) fscanf(fans,"%lf",&ans[i]); for(i=1;i<=n;++i) fscanf(fout,"%lf",&out[i]); int ok=0; for(i=1;i<=n;++i){ if(fabs(ans[i])<eps) ok+=fabs(out[i])<eps; else ok+=(fabs(ans[i]-out[i])/ans[i])<eps; } double _p=ok/(double)n,p=5; for(i=1;i<=7;++i) p*=_p; int score=int(p); if(score!=5) return OJ_WA; return OJ_AC; }
Aug 19, 2015 04:46:04 PM
那cena和lemon spj的模板呢
Aug 19, 2015 08:55:01 PM
@pengzhou: http://wyfcyx.is-programmer.com/posts/77528.html