class Solution { public: int binaryGap(int N) { int position = 0; vector<int> V; while (N) { if (N & 1)//N&1==1,表示最后一位是1 {
转载 2018-09-28 19:45:00
19阅读
868. Binary Gap* https://leetcode.com/problems/binary-gap/
原创 2022-05-30 10:34:11
61阅读
题目传送门 一、理解与感悟 先去掉2的倍数,再去掉3的倍数,再去掉4的倍数,……依此类推,最后剩下的就是素数。 如求100以内的素数,我们只要到去掉sqrt(100)的倍数就可以了,这是因为10的2倍已经被2的倍数去掉了,10的3倍已经被3的倍数去掉了,所以到10的时候只剩下10的10倍以上的素数还
原创 2021-09-29 16:23:31
477阅读
Given a positive integer N, find and return the longest distance between two consecutive 1's in the binary representation of N. If there aren't two co
转载 2018-10-29 13:12:00
61阅读
2评论
路线计算时间限制:1000 ms  |  内存限制:65535 KB难度:1描述 有测试实例,请输出蜜蜂从蜂房a爬到蜂房b的可
原创 2022-07-29 13:53:31
61阅读
As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet
转载 2017-10-05 19:44:00
156阅读
2评论
题目链接:http://codeforces.com/contest/868/problem/A 题意:给你一个由两个字母组成
原创 2022-11-23 10:21:54
51阅读
LeetCode: 868. Binary Gap
原创 2022-12-06 00:44:19
103阅读
题目 给定一个正整数 $n$,请你求出 $1∼n$ 中质数的个数。 输入格式 共一行,包含整数 $n$。 输出格式 共一行,包含一个整数,表示 $1∼n$ 中质数的个数。 数据范围 $1≤n≤10^6$ 输入样例: 8 输出样例: 4 思路 朴素筛选 遍历到某个数值 $i$ 我们将它的倍数全部删除,如此反复,剩下的为 $1∼n$ 中的所有质数 代码 朴素筛选法 #include <
原创 2023-08-22 20:22:58
106阅读
LeetCode: 868. Transpose Matrix题目描述Given a matrix A, return the transpose of A. The transpose of a matrix is the matrix flipped over it’s main diagonal, switching the row and column indices of th...
原创 2022-12-06 00:51:59
89阅读
DescriptionGiven a positive integer n, find and return the longest distance between any t
原创 2022-08-12 07:49:54
80阅读
问题描述 给定一个正整数 n,找到其中最大的二进制位上的间隙长度。二进制位上的间隙是指在二进制表示中,两个 1 之间的 0 的数量。 示例 1: 输入: n = 22 输出: 2 解释: 22 的二进制是 10110。 在 22 的二进制表示中,有四个间隙 3, 1, 1, 和 2。 最大间隙是 2。 示例 2: 输入: n = 5 输出: 2 解释: 5 的二进制是 101。 在 5 的二进制表
原创 1月前
56阅读
CLVI.CF868E Policeman and a Tree DP是很容易想的。但是如何设计状态呢? 一开始我自己假设了一个结论:在警察出发前,所有罪犯会排成此时的最优方案,然后不动;然后在警察抓到一个罪犯后,所有罪犯会再度排成最优方案,之后就一直不动了。但是如果这样做的话 \(50\) 的数据
转载 2021-03-31 15:42:00
107阅读
2评论
You are given n strings s1, s2, ..., sn consisting of characters 0 and 1. m operations are performed, on each of them you concatenate two existing str
转载 2017-10-15 16:18:00
92阅读
2评论
题目Given a positive integer N, find and return the longest distance between two consecu
原创 2022-12-14 14:53:28
34阅读
题目链接:http://codeforces.com/contest/868/problem/C 题意:有n到题目,有k支队为
原创 2022-11-23 10:21:50
36阅读
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and th
转载 2017-10-05 20:05:00
116阅读
2评论
Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And
转载 2017-10-05 19:48:00
218阅读
2评论
Description Snark and Philip are preparing the problemset for the upcoming pre-qualification round for
原创 2022-08-10 10:17:39
88阅读
操作系统:Solaris 数据库环境:9i 9.2.0.8不知道是Oracle的600bug太多还是最近笔者运气太好,经常遇到600bug,上礼拜5在处理完客户数据库无法正常启动后,立马出现了600bug,详细错误如下ORA-00600: internal error code, arguments: [504], [0x38006F868], [160], [7], [share...
转载 2022-09-20 17:44:34
83阅读
  • 1
  • 2
  • 3
  • 4
  • 5