提交时间:2022-08-03 15:22:44

运行 ID: 56855

#include<bits/stdc++.h> using namespace std; int main() { int i,a[11]; while(cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]){ if(a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0)return 0; int zt=0,x=a[2]-a[1]; for(i=3;i<=5;i++){ if(a[i]-a[i-1]!=x){ zt=1; break; } } if(zt==0){ for(i=6;i<=10;i++){ cout<<a[i-1]+x<<" "; a[i]=a[i-1]+x; } cout<<endl; continue; } int y=a[2]/a[1]; zt=1; for(i=3;i<=5;i++){ if(a[i]%a[i-1]!=0||a[i]/a[i-1]!=y){ zt=3; break; } } if(zt==1){ for(i=6;i<=10;i++){ cout<<a[i-1]*y<<" "; a[i]=a[i-1]*y; } cout<<endl; continue; } for(i=6;i<=10;i++){ cout<<a[i-2]+a[i-1]<<" "; a[i]=a[i-2]+a[i-1]; } cout<<endl; } return 0; }