Problem 1342B - Binary Period (思维)


AC代码:
#include<bits/stdc++.h>
using namespace std;
int main() {
//freopen("in.txt", "r", stdin);
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int t; cin >> t;
while (t--) {
string s, a = ""; cin >> s;
for (auto p : s)
a += "01";
if (s.find('0') == string::npos || s.find('1') == string::npos)
cout << s << endl;
else cout << a << endl;
}
}
Problem 1342B - Binary Period (思维)的更多相关文章
- 2019牛客多校第三场B Crazy Binary String 思维
Crazy Binary String 思维 题意 给出01串,给出定义:一个串里面0和1的个数相同,求 满足定义的最长子序列和子串 分析 子序列好求,就是0 1个数,字串需要思考一下.实在没有思路可 ...
- [LeetCode&Python] Problem 257. Binary Tree Paths
Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example ...
- [LeetCode&Python] Problem 107. Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left ...
- [LeetCode&Python] Problem 401. Binary Watch
A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom ...
- [LeetCode&Python] Problem 563. Binary Tree Tilt
Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the ab ...
- [LeetCode&Python] Problem 693. Binary Number with Alternating Bits
Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will a ...
- [LeetCode&Python] Problem 868. Binary Gap
Given a positive integer N, find and return the longest distance between two consecutive 1's in the ...
- FZU - 2214 Knapsack problem 01背包逆思维
Knapsack problem Given a set of n items, each with a weight w[i] and a value v[i], determine a way t ...
- codeforces 807 D. Dynamic Problem Scoring(贪心+思维)
题目链接:http://codeforces.com/contest/807/problem/D 题意:对于动态计分的 Codeforces Round ,已知每题的 score 是根据 Round ...
- HDU - 6242 Geometry Problem (几何,思维,随机)
Geometry Problem HDU - 6242 Alice is interesting in computation geometry problem recently. She found ...
随机推荐
- 工厂模式(Factory Method)
模式定义 定义一个用于创建对象的接口,让子类决定实例化哪一个类.Factory Method使得一个类的实例化延迟(目的:解耦)到子类. 要点总结 Factory Method模式用于隔离类对象的使用 ...
- springboot集成mybatis-plus
集成mybatis-plus 1.添加pom.xml <!--mp逆向工程 --> <dependency> <groupId>org.projectlombok& ...
- HBase|idea使用hbase进行简单的DDL增删改查
老师要测试什么的,所以我想练习一下,顺便记录在博客里,如有错误,敬请指正,谢谢!!! idea连接hbase 首先确保你可以打开Hbase http://192.168.40.100:16010 查看 ...
- git可视化管理工具有哪些?
在 Git 中,有许多可视化管理工具可供使用.以下是一些常见的 Git 可视化管理工具及其功能的详细介绍. GitHub Desktop: GitHub Desktop 是由 GitHub 官方推出的 ...
- 关于mac电脑突然搜不到家里wifi但手机却能连上的问题解决
今天用mac电脑时,突然遇到一个奇怪的问题,家里wifi用的好好的,突然就连不上了,在看电脑能搜索到的wifi,居然家里的wifi都没有搜索到,但自己的手机却是正常的,然后我再看看我另外一台windo ...
- 深度解析C#中LinkedList<T>的存储结构
本文承接前面的3篇有关C#的数据结构分析的文章,对于C#有关数据结构分析还有一篇就要暂时结束了,这个系列主要从Array.List.Dictionary.LinkedList. SortedSet等5 ...
- 记一次解决RestTemplate和HttpClient请求结果乱码的问题
调用一个接口,发送POST请求,浏览器和Postman均返回正常,代码中用RestTemplate和HttpClient均返回乱码 开始一直以为是编码问题导致,网上查了解决方法,也看了源码,都不对症 ...
- Python 潮流周刊第 30 期(摘要)
本周刊由 Python猫 出品,精心筛选国内外的 250+ 信息源,为你挑选最值得分享的文章.教程.开源项目.软件工具.播客和视频.热门话题等内容.愿景:帮助所有读者精进 Python 技术,并增长职 ...
- scroll-view和swiper的使用
源码: <template> <viex class="out"> <view class="b ...
- Ubuntu系统部署后优化
Ubuntu系统配置调整 前期准备 #更改主机名,重启后不变 hostnamectl set-hostname Zabbix-Server01 #更改主机名,重启后变回从前 hostname Zabb ...