当前位置:网站首页>Niuke - Practice 101 - reasoning clown
Niuke - Practice 101 - reasoning clown
2022-07-01 23:51:00 【why151】
Reasoning clown
Title Description

Main idea :
This problem is mainly solved by an attempt .
Try from high to low .
If the high position can not be 1 Just be satisfied < Words , Then don't be high 1;
If the high position is not 1 Will appear > Words , Then the high position must be 1;
If appear = In the case of , Need to look back , If you can't, then 1.
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e5+10;
int n;
int a[N];
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
cin>>a[i];
int ans=0;
for(int i=30;i>=0;i--)
{
int now=ans;
bool flag;
for(int j=i-1;j>=0;j--)
{
now|=1<<j;
flag=1;
for(int k=1;k<n;k++) {
if((a[k]&now)>(a[k+1]&now))
{
flag=0;
break;
}
}
if(!flag) now^=1<<j;
}
flag=1;
for(int k=1;k<n;k++)
{
if((a[k]&now)>=(a[k+1]&now))
{
flag=0;
break;
}
}
if(!flag) ans|=1<<i;
}
cout<<ans<<endl;
return 0;
}
边栏推荐
- 【CMake】Qt creator 里面的 cmake 配置
- 牛客-练习赛101-推理小丑
- Various global files related to [.Net core] program
- E-commerce RPA robot helps brand e-commerce to achieve high traffic
- ADO.NET之SqlDataAdpter对象
- cookie、session、tooken
- openwrt 开启KV漫游
- Kubernetes resource object introduction and common commands (III)
- BlocProvider为什么感觉和Provider很相似?
- Multi table operation - one to one, one to many and many to many
猜你喜欢

PostgreSQL source code (57) why is the performance gap so large in hot update?

Matplotlib common charts

边缘计算概述

Huawei HMS core joins hands with hypergraph to inject new momentum into 3D GIS

Redis RDB snapshot

Current situation and future development trend of Internet of things

2021 RoboCom 世界机器人开发者大赛-高职组复赛

回顾数据脱敏系统

【CMake】Qt creator 里面的 cmake 配置

TS初次使用、ts类型
随机推荐
Is it safe to buy funds on Great Wall Securities?
Windows 7 install MySQL error: 1067
cookie、session、tooken
PostgreSQL source code (57) why is the performance gap so large in hot update?
2021 RoboCom 世界机器人开发者大赛-高职组复赛
Leetcode (34) -- find the first and last positions of elements in a sorted array
.env.xxx 文件,加了常量,卻undefined
Concepts of dictionary, hash table and array
Using SqlCommand objects in code
mysql:insert ignore、insert和replace区别
2021 robocom world robot developer competition - preliminary competition of higher vocational group
Using uni simple router, dynamically pass parameters typeerror: cannot convert undefined or null to object
ConcurrentSkipListMap——跳表原理
BlocProvider为什么感觉和Provider很相似?
ADO. Net SqlCommand object
2021 robocom world robot developer competition - semi finals of higher vocational group
vs2015 AdminDeployment. xml
Door level modeling - after class exercises
Learn online case practice
【.Net Core】程序相关各种全局文件