1 条题解

  • 0
    @ 2025-2-11 11:52:02
    #include<bits/stdc++.h>
    #define long long int 
    using namespace std;
    const int N=1e5+5,INF=0x3f3f3f3f;
    int a[11];
    bool End(){
    	for(int i=1;i<=5;i++)if(a[i]!=0)return 0;
    	return 1;
    }
    bool cha(){
    	for(int i=2;i<=4;i++)if(a[i]-a[i-1]!=a[i+1]-a[i])return 0;
    	return 1;
    }
    bool bi(){
    	for(int i=2;i<=4;i++)if(a[i]/a[i-1]!=a[i+1]/a[i]||a[i]%a[i-1]!=0||a[i+1]%a[i]!=0)return 0;
    	return 1;
    }
    void chaans(){
    	int chai=a[2]-a[1];
    	for(int i=6;i<=10;i++){
    		a[i] = a[i-1]+chai;
    		cout<<a[i]<<" ";
    	}
    	cout<<endl;
    }
    void bians(){
    	int bii=a[2]/a[1];
    	for(int i=6;i<=10;i++){
    		a[i] = a[i-1]*bii;
    		cout<<a[i]<<" ";
    	}
    	cout<<endl;
    }
    void feians(){
    	for(int i=6;i<=10;i++){
    		a[i] = a[i-1]+a[i-2];
    		cout<<a[i]<<" ";
    	}
    	cout<<endl;
    }
    int main()
    {
    	while(cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]){
    		if(End())break;
    		if(cha())chaans();
    		else if(bi())bians();
    		else feians();
    	}
    	return 0;
    }
    
    • 1

    信息

    ID
    1289
    时间
    1000ms
    内存
    32MiB
    难度
    10
    标签
    递交数
    1
    已通过
    1
    上传者