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 ...
随机推荐
- 总结(6)--- python基础知识点小结(细全)
==================================================================================================== ...
- 使用Druid解析SQL实现血缘关系计算
import com.alibaba.druid.sql.SQLUtils; import com.alibaba.druid.sql.ast.SQLStatement; import com.ali ...
- oracle、达梦数据库、MySQL数据创建表与字段注释
/**1.oracle注释*//*表本身注释*/comment on table 表名 is '注释信息';/*字段注释*/comment on column 表名.字段名 is '注释信息';/*实 ...
- React Hooks 钩子特性
人在身处逆境时,适应环境的能力实在惊人.人可以忍受不幸,也可以战胜不幸,因为人有着惊人的潜力,只要立志发挥它,就一定能渡过难关. Hooks 是 React 16.8 的新增特性.它可以让你在不编写 ...
- 基于 Webpack5 Module Federation 的业务解耦实践
我们是袋鼠云数栈 UED 团队,致力于打造优秀的一站式数据中台产品.我们始终保持工匠精神,探索前端道路,为社区积累并传播经验价值. 本文作者:贝儿 前言 本文中会提到很多目前数栈中使用的特定名词,统一 ...
- ubuntu 20.04系统上安装teleport开源堡垒机
ubuntu 20.04安装部署teleport堡垒机 简介:Teleport是一款简单易用的开源堡垒机系统,具有小巧.易用的特点,支持 RDP/SSH/SFTP/Telnet 协议的远程连接和审计管 ...
- MybatisPlus高级特性之SimpleQuery工具类
1.是很么? SimpleQuery可以对selectList查询后的结果使用Stream流进行操作,使其可以返回指定的结果,简洁了api的调用 2.怎么玩? 案例演示 (1) list操作 /** ...
- LeetCode1806:还原排列的最少操作步数(置换群 or 模拟)
题意:题目的意思是,给定一个初始状态perm,然后对perm的每个元素按照上述的规则进行变换操作.问:perm经过多少次这种操作能够变回初始的perm. 解题思路:第一种方法就是模拟,一直变换,直到变 ...
- Linux云服务器购买,学习
购买云服务器的初衷 作为一名自动化测试工程师,不能仅限于掌握工作上的业务和代码,业余时间需要找点开源项目来练习性能.接口.UI自动化. 云服务器购买 https://www.aliyun.com/ 我 ...
- Python——第二章:查找和判断
查找.find() s = "你好啊. 我叫周润发" ret = s.find("周润发") # 返回是7,代表该字符串出现在7号位置,从0开始计数 print ...