当前位置:网站首页>11.2-HJ86 求最大连续bit数
11.2-HJ86 求最大连续bit数
2022-07-25 18:13:00 【syc596】
HJ86 求最大连续bit数
求最大连续bit数_牛客题霸_牛客网 (nowcoder.com)
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
int count=0;
int ret=0;
while(n!=0){
if((n&1)==1){
count++;
if(count>ret){
ret=count;
}
}else{
count=0;
}
n>>=1;
}
System.out.println(ret);
}
}
}边栏推荐
- 3DCAT v2.1.3新版本发布,这三大功能更新你不容错过!
- Mock service Moco series (III) - redirection, regular expression, delay, template, event, sub module design
- Cloud XR面临的问题以及Cloud XR主要应用场景
- Related operations of binary tree
- testng执行顺序的3中控制方法
- SDLC software development life cycle and model
- SQL那些事
- 云流化和云桌面有什么关系
- C LINQ de Duplication & de duplication sum
- Could not stop Cortex-M device! Please check the JTAG cable solution
猜你喜欢

Kendryte K210 在freertos上的lcd屏幕的使用

Installation and operation instructions of SVN client (TortoiseSVN)

How to judge the performance of static code quality analysis tools? These five factors must be considered

Keil5 “Loading PDSC Debug Description Failed for STMicroelectronics STM32Hxxxxxxx”解决办法

Ch582 ble 5.0 uses Le coded broadcast and connection

Drawing PDF tables (I) drawing excel table styles in PDF and downloading them through iText (supporting Chinese fonts)

1---电子实物认知

超全Mavan标签详解

使用sqldeveloper连接mysql
SQL optimizer parsing | youth training camp notes
随机推荐
STM8S003F3 uart的使用
Use of LCD screen of kendryte k210 on FreeRTOS
MySQL optimistic lock
「行话」| 用DevOps高效交付游戏,是种什么体验?
SDLC 软件开发生命周期及模型
Error when starting MySQL on Linux
排序还需要了解的信息以及链表
H5测试点(思维导图)
Mock service Moco series (II) - JSON format, file file, header, cookie, solving Chinese garbled code
Linux启动mysql报错
C语言 整数与字符串的相互转换
"Deprecated gradle features were used in this build, making it incompatible with gradle 6.0" problem solving
Tkinter GUI address book management system
srec_ Use of common cat parameters
Unity 贝塞尔曲线的创建
Auditing related notes
Stm8s003f3 internal flash debugging
虚拟偶像代言产品出问题谁负责?
Use of join function in MATLAB
UFT(QTP)-总结点与自动化测试框架