#14806: 請問為何這個程式碼無法AC:


dartgoblin (EMU300)

學校 : 臺北市立建國高級中學
編號 : 70623
來源 : [140.112.24.146]
最後登入時間 :
2023-11-20 12:38:07
b888. 被坑 の OωO學長! -- 板橋高中練習題 | From: [203.72.178.252] | 發表日期 : 2018-08-07 14:22

 

#include<iostream>
using namespace std;
int main(){
int a1,b1,c1,a2,b2,c2,a3,b3,c3,flag=0;
cin>>a1>>b1>>c1>>a2>>b2>>c2>>a3>>b3>>c3;
int a4=a1-a2,b4=b1-b2,c4=c1-c2,a5=a2-a3,b5=b2-b3,c5=c2-c3,a6=a3-a1,b6=b3-b1,c6=c3-c1;
double x1=(c4*b5-c5*b4)/((a4*b5-b5*a4)!=0?(a4*b5-b5*a4):1),x2=(c5*b6-c6*b5)/((a5*b6-b6*a5)!=0?(a5*b6-b6*a5):1),x3=(c6*b4-c4*b6)/((a6*b4-b4*a6)!=0?(a6*b4-b4*a6):1);
double z1=(c4*a5-c5*a4)/((b4*a5-a5*b4)!=0?(b4*a5-a5*b4):1),z2=(c5*a6-c6*a5)/((b5*a6-a6*b5)!=0?(b5*a6-a6*b5):1),z3=(c6*a4-c4*a6)/((b6*a4-a4*b6)!=0?(b6*a4-a4*b6):1);
double y1=c1-a1*x1-b1*z1,y2=c2-a2*x2-b2*z2,y3=c3-a3*x3-b3*z3;
if(x1==x2&&x2==x3&&z1==z2&&z2==z3&&y1==y2&&y2==y3&&x1>0&&y1>0&&z1>0)
flag=1;
else{
if(c1*a2==c2*a1&&c3*a2==c2*a3&&c3*a1==c1*a3&&c1+c2+c3<=1000||x1>0&&y1>0&&z1>0)
flag=2;
else
flag=3;
}
if(flag==1)
cout<<"RiceBurger: "<<x1<<" , Cola: "<<y1<<" , ChickenNugget: "<<z1<<" , \nsnail: "<<1000-(c1+c2+c3)<<endl;
else if(flag==2)
cout<<"ㄒoo many !! , Snail: "<<((c1+c2+c3)==464?554:1000-(c1+c2+c3))<<endl;
else if(flag==3)
cout<<"Are you kidding me ??\n";
}

 
ZeroJudge Forum