#17905: 請問一下哪裡錯><


easylin0126@gmail.com (林榮翼)

學校 : 臺北市立成功高級中學
編號 : 89424
來源 : [140.114.207.162]
最後登入時間 :
2023-09-27 16:33:24
b893. 勘根定理 -- 板橋高中教學題 | From: [61.61.22.12] | 發表日期 : 2019-05-31 21:51

最後兩題的測資一直OLE
請勿輸出題目未要求的文字: 34 35
想請問一下是哪裡出錯
#include<stdio.h>
#include<math.h>
int a,b,c,d,e,f,flag;
void fun(int num1,int num2){
long long int temp=a*(int)pow(num1,5)+b*(int)pow(num1,4)+c*(int)pow(num1,3)+d*(int)pow(num1,2)+e*num1+f;
long long int temp2=a*(int)pow(num2,5)+b*(int)pow(num2,4)+c*(int)pow(num2,3)+d*(int)pow(num2,2)+e*num2+f;
if((temp>0&&temp2>0)||(temp<0&&temp2<0))
return;
flag=1;
if(!temp2)
printf("%d %d\n",num2,num2);
else if((temp>0&&temp2<0)||(temp<0&&temp2>0))
printf("%d %d\n",num1,num2);
return;
}
int main(){
int i;
while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)!=EOF){
flag=0;
if(!a&&!b&&!c&&!d&&!e&&!f){
printf("Too many... = =\"\n");
continue;
}
for(i=-35;i<=35;i++){
fun(i,i+1);
}
if(!flag)
printf("N0THING! >\\\\\\<\n");
}
}
 
ZeroJudge Forum