#include
int main() {char str[30]="";int ans=0;int number[4]={0};int count=0;const char* d = " ";char *p;scanf("%[^\n]",str);p = strtok(str, d);count=0;while (p != NULL) {number[count++]=atoi(p);p = strtok(NULL, d);if (count==4)break;}if(number[3]-number[2]==number[2]-number[1]){//等差number[4]=(number[3]-number[2])+number[3];}else if(number[3]/number[2]==number[2]/number[1]){//等比number[4]=(number[3]/number[2])*number[3];}if(count>=4){for(int x=0; x<=count; x++) {printf("%d ",number[x]);}}else{printf("\r");}//printf("%d\n",ans);return 0;}
輸入第一行是數列的數目