自己測試的時候是沒問題的,放上來就錯
沒事了,謝謝
#includeint main(){int Y[5],a,b,c,d,e,t,i,j;scanf("%d",&t);for(j=1;j<=t;j++){scanf("%d %d %d %d",&a,&b,&c,&d);Y[0]=a;Y[1]=b;Y[2]=c;Y[3]=d;if ((c-b)==(b-a)){Y[4]=c-b+d;}else{e=d*((c-b)/(b-a));Y[4]=e;}for(i=0;i<=4;i++){printf("%d ",Y[i]);}printf("\n");}return 0;}後來簡化的第二種,過了#includeint main(){int a,b,c,d,e,t,i,j;scanf("%d",&t);for(j=1;j<=t;j++){scanf("%d %d %d %d",&a,&b,&c,&d);if ((c-b)==(b-a)){e=c-b+d;}else{e=d*((c-b)/(b-a));}printf("%d %d %d %d %d ",a,b,c,d,e);printf("\n");}return 0;}感謝學校老師,錯誤的都改過了,歡迎參考