提交时间:2022-08-11 18:36:46

运行 ID: 58374

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