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 |
算法比较烂,但是我觉得思路还是没问题的,但是提交就wa,如果哪位又时间的话帮我看一下是什么问题!先谢了!#include <iostream> using namespace std; #include <cmath> int main() { double p1[4][3],p2[4][3]; while(cin>>p1[1][1]>>p1[1][2]>>p1[2][1]>>p1[2][2]>>p1[3][1]>>p1[3][2] >>p2[1][1]>>p2[1][2]>>p2[2][1]>>p2[2][2]>>p2[3][1]>>p2[3][2],abs(p1[1][1]+100)>=10e-8) { double r1[4],r2[4]; int i,score1=0,score2=0; for(i=1;i<=3;i++) { r1[i]=sqrt(p1[i][1]*p1[i][1]+p1[i][2]*p1[i][2]); if(r1[i]<=3.0&&r1[i]>=0) score1+=100; else if(r1[i]<=6.0) score1+=80; else if(r1[i]<=9.0) score1+=60; else if(r1[i]<=12.0) score1+=40; else if(r1[i]<=15.0) score1+=20; else ; } for(i=1;i<=3;i++) { r2[i]=sqrt(p2[i][1]*p2[i][1]+p2[i][2]*p2[i][2]); if(r2[i]<=3.0&&r2[i]>=0) score2+=100; else if(r2[i]<=6.0) score2+=80; else if(r2[i]<=9.0) score2+=60; else if(r2[i]<=12.0) score2+=40; else if(r2[i]<=15.0) score2+=20; else if(r2[i]>15.0) score2+=0; } if(score1<score2)cout<<"SCORE: "<<score2<<" to "<<score1<<", PLAYER 2 WINS."<<endl; if(score1>score2) cout<<"SCORE: "<<score1<<" to "<<score2<<", PLAYER 1 WINS."<<endl; if(score1==score2) cout<<"SCORE: "<<score1<<" to "<<score2<<", TIE."<<endl; } system("pause"); return (0); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator