#include <algorithm> #include <iostream> #include <vector> #include <string> using namespace std; string bin2(int n) { string str=""; while (n!=0) { str = to_string(n % 2) + str; n = n/ 2; } return str; } void fun(string a) { int count = 0; int begin = -1; while ((begin = a.find("101", begin + 1)) != string::npos) { count++; } cout << count << " "; cout << a.find_first_of("101") << endl; } int main()  { int n; string a; while (cin >> n) { a = bin2(n); reverse(a.begin(), a.end()); fun(a); } }
点赞 评论

相关推荐

见见123:简历没有啥问题,是这个社会有问题。因为你刚毕业,没有工作经历,现在企业都不要没有工作经历的。社会病了。
点赞 评论 收藏
分享
LemontreeN:有的兄弟有的我今天一天面了五场,4个二面一个hr面
投递字节跳动等公司7个岗位
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务