#include "iostream" #include "cstdio" using namespace std; #define LL long long #define N 100020 int a[N],b[N]; void init() { a[0]=0;a[1]=a[2]=1; b[0]=0;b[1]=b[2]=1; for(int i=3;i<N;i++){ if(i%2) a[i]=a[i/2]+a[i/2+1]; else a[i]=a[i/2]; b[i]=max(b[i-1],a[i]); } } int main(){ //freopen("in.txt","r",stdin); init(); int t,n; scanf("%d",&t); while(t--){ scanf("%d",&n); printf("%d\n",b[n]); } return 0; }
时间: 2024-12-12 10:21:46