当前位置:网站首页>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);
}
}
}边栏推荐
- Oracle使用impdp导入报错:ORA-39001: 参数值无效 ORA-39000: 转储文件说明错误 ORA-39088: 文件名不能包含路径说明
- How to judge the performance of static code quality analysis tools? These five factors must be considered
- BiSeNet v1
- 更新|3DCAT实时云渲染 v2.1.2版本全新发布
- UFT(QTP)-总结点与自动化测试框架
- Wu Enda's machine learning programming operation cannot be suspended pause problem solved
- C# Linq 去重&去重求和
- Drawing PDF tables (I) drawing excel table styles in PDF and downloading them through iText (supporting Chinese fonts)
- php内存管理机制与垃圾回收机制
- 超全Mavan标签详解
猜你喜欢
随机推荐
Installation and operation instructions of SVN client (TortoiseSVN)
C语言 整数与字符串的相互转换
H5测试点(思维导图)
Basic knowledge of software testing (mind mapping)
Why is the index in [mysql] database implemented by b+ tree? Is hash table / red black tree /b tree feasible?
「行话」| 用DevOps高效交付游戏,是种什么体验?
Wu Enda's machine learning programming operation cannot be suspended pause problem solved
Cloud VR: the next step of virtual reality specialization
SQL那些事
3DCAT v2.1.3新版本发布,这三大功能更新你不容错过!
Kendryte K210 在freertos上的lcd屏幕的使用
Hit the test site directly: summary of common agile knowledge points in PMP examination
二叉树的相关操作
Bl602 development environment setup
Mock service Moco series (II) - JSON format, file file, header, cookie, solving Chinese garbled code
Thales launches solutions to help SAP customers control cloud data
How to choose digital twin visualization platform
Li Kai: the interesting and cutting-edge audio and video industry has always attracted me
Stm32f105rbt6 internal flash debugging
Oracle import error: imp-00038: unable to convert to environment character set handle








