#34368: C ans


yp11151049@yphs.tp.edu.tw (801-24)

學校 : 臺北市私立延平高級中學
編號 : 197224
來源 : [203.72.178.1]
最後登入時間 :
2024-01-16 09:26:24
a251. 假費波那契數 -- 2011成功高中校內賽初賽第一題 | From: [203.72.178.1] | 發表日期 : 2023-03-15 17:13

#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n,f[20];
        cin>>n>>f[1]>>f[2]>>f[3]>>f[4];
        for(int i=5;i<=n;i++) f[i]=f[i-4]+f[i-1];
        sort(f+1,f+n+1);
        cout<<f[n/2+1]<<endl;
    }
    return 0;
}

 
ZeroJudge Forum