zoukankan      html  css  js  c++  java
  • Codeforces Round #633 (Div. 2) C

    //#include<bits/stdc++.h>
    #include<map>
    #include<queue>
    #include<cstdio>
    #include<cstring>
    #include<iostream>
    #include<algorithm>
    #define int long long
    using namespace std;
    #define rep_1(i,m,n) for(int i=m;i<=n;i++)
    #define mem(st) memset(st,0,sizeof st)
    int read()
    {
    	int res=0,ch,flag=0;
    	if((ch=getchar())=='-')             //判断正负
    		flag=1;
    	else if(ch>='0'&&ch<='9')           //得到完整的数
    		res=ch-'0';
    	while((ch=getchar())>='0'&&ch<='9')
    		res=res*10+ch-'0';
    	return flag?-res:res;
    }
    typedef long long ll;
    typedef pair<int,int> pii;
    typedef unsigned long long ull;
    typedef pair<double,double> pdd;
    const int inf = 0x3f3f3f3f;
    const int N=1e5+10;
    int a[N];
    void work()
    {
    	int n=read();
    	for(int i=1; i<=n; i++)
    		a[i]=read();
    	int ans=0;
    	for(int i=2; i<=n; i++)
    	{
    		if(a[i-1]<=a[i])
    			continue;
    		int l=1,r=33;
    		while(l<r)
    		{
    			int mid=(l+r)/2;
    			int res=(1ll<<mid)-1;
    			if(a[i-1]<=a[i]+res)
    				r=mid;
    			else
    				l=mid+1;
    		}
    		ans=max(ans,l);
    		a[i]=a[i-1];
    	}
    	printf("%d
    ",ans);
    }
    signed main()
    {
    	int t;
    	cin>>t;
    	while(t--)
    		work();
    	return 0;
    }
    
    
    
  • 相关阅读:
    redis 资料
    php 安装redis php扩展
    Unity生命周期
    疫情下的大学生人格发展研究
    对联一句——百花深处
    Unity实现byte[]合成图像
    Unity实现精灵资源动态加载
    数据结构与算法初步
    Unity中激活子物体
    C#实现自定义列表
  • 原文地址:https://www.cnblogs.com/QingyuYYYYY/p/12690006.html
Copyright © 2011-2022 走看看