例如,若t1=7,t2=5,t3=6,t4=4,n=10,则总共可听到28次鞭炮声。
请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。
注意:源程序存放在考生文件夹下BLANK1.C中。
不得增行或删行,也不得更改程序的结构!
给定源程序:
#include
/**********found**********/
#define OK(i, t, n) ((___1___%t==0) && (i/t
int fun(int t1, int t2, int t3, int t4, int n)
{int count, t , maxt=t1;
if (maxt < t2) maxt = t2;
if (maxt < t3) maxt = t3;
if (maxt < t4) maxt = t4;
count=1; /* 给count赋初值 */
/**********found**********/
for(t=1; t< maxt*(n-1); ___2___)
{
if(OK(t, t1, n) || OK(t, t2, n)|| OK(t, t3, n) || OK(t, t4, n))
count++;
}
/**********found**********/
return ___3___;
}
main()
{int t1=7, t2=5, t3=6, t4=4, n=10, r;
r = fun(t1, t2, t3, t4, n);
printf("The sound : %d\n", r);
}
解题答案:
/**********found**********/
for(t=1; t< maxt*(n-1); t++)
/**********found**********/
return count;
******************************************
相关专题:
编辑推荐: