为什么这道题会WA描述Given N arithmetic expressions,can you tell whose
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 11:39:35
为什么这道题会WA
描述
Given N arithmetic expressions,can you tell whose result is closest to
输入
Line 1:N (1
描述
Given N arithmetic expressions,can you tell whose result is closest to
输入
Line 1:N (1
#include
#include
#include
#include
int main()
{
int N=0,i=0,j=0,pa,pb;
int index =0;
\x05double sum=10;
char oper = '+';
double * res;
scanf("%d\n",&N);
res = (double *)malloc(N*8);
for(i=0;i res[i])?i:index;
sum = (sum > res[i])?res[i]:sum;
case '-':res[i]=abs((pa - pb)-9); index = (sum > res[i])?i:index;
sum = (sum > res[i])?res[i]:sum;
case '*':res[i]=abs((pa * pb)-9); index = (sum > res[i])?i:index;
sum = (sum > res[i])?res[i]:sum;
case '/':res[i]=fabs((pa*1.0 / pb)-9); index = (sum > res[i])?i:index;
sum = (sum > res[i])?res[i]:sum;
}
}
printf("%d\n",index+1);
return 0;
}
//刚做完,仅供参考
#include
#include
#include
int main()
{
int N=0,i=0,j=0,pa,pb;
int index =0;
\x05double sum=10;
char oper = '+';
double * res;
scanf("%d\n",&N);
res = (double *)malloc(N*8);
for(i=0;i res[i])?i:index;
sum = (sum > res[i])?res[i]:sum;
case '-':res[i]=abs((pa - pb)-9); index = (sum > res[i])?i:index;
sum = (sum > res[i])?res[i]:sum;
case '*':res[i]=abs((pa * pb)-9); index = (sum > res[i])?i:index;
sum = (sum > res[i])?res[i]:sum;
case '/':res[i]=fabs((pa*1.0 / pb)-9); index = (sum > res[i])?i:index;
sum = (sum > res[i])?res[i]:sum;
}
}
printf("%d\n",index+1);
return 0;
}
//刚做完,仅供参考
为什么这道题会WA描述Given N arithmetic expressions,can you tell whose
Can you tell it to the man in whose house you lived for 为什么用
can you make sentences using the following expressions? 为什么用
can you tell me?whose backpack is that?合并成一句我的答案can you tell
Excuse me,can you please tell me where i can get_______?I wa
can you tell me something about Beijing What is the great wa
can you tell me by whom the talk will be given 什么句型 whom 定语从
Can you tell me whose book is it这句话对吗
can you tell me?whose backpack is black?两句合成一句
can you tell me ______ this is?A.what; B.if; C.whose; D.who
can you tell me with ____ he is talking?a.whose b.whom c.tha
为什么是“Can you tell me when he bought the car"而不是"Can you tell