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 ...
随机推荐
- java.util.List如何用
起因是这样,我在学习Javaweb,然后就突然有很多类似的语句 这是什么意思呢?让我们一起来解决看看吧! List有序集合(也成为序列),用户可以精确控制列表中每个元素的插入位置.用户可以通过整数索引 ...
- c语言实现this指针效果
概要 由于目前在做一个比较复杂的嵌入式项目,想要借此提升一下代码的结构设计能力,所以想要以面向对象的思想来完成这个项目,即把每个板载外设资源视为一个对象,采用msp+bsp的模式,对每个bsp外设实现 ...
- JVM整理笔记
1.JVM位置 JVM是作用在操作系统之上的,它与硬件没有直接的交互 2.JVM体系结构 3.类装载器ClassLoader 类装载器:负责加载class文件,class文件在文件开头有特定的文件标示 ...
- JXNU acm选拔赛 壮壮的数组
壮壮的数组 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Submiss ...
- flask应用程序配置
flask中配置app的配置有几种方式,不同的场景适合用不同的方式. 配置定义方式如下:(注意:这几种方式都时可以混用的) 直接调用app.config来设置. app.config["SE ...
- pycharm设置Ctrl+鼠标滚轮放大缩小字体
方式一: File --> setting --> Editor-->General,勾选. 方式二: 放大的设置 File --> setting --> Keymap ...
- Docker下的SqlServer发布订阅启用
一.准备一个Docker的sqlserver #创建挂载数据文件夹 mkdir -p /home/mssql/data #创建挂载日志文件夹 mkdir /home/mssql/log #给文件夹权限 ...
- [Luogu 4912 帕秋莉的魔法] 题解报告
算法:DP, 背包,动态规划 简化版题目: 给定 \(n\) 个物品,物品的价值为 \(v_1 - v_n\),物品的体积为 \(w_1 - w_n\).需要选择一些物品,使它们的体积和为 \(V\) ...
- 使用 PostgreSQL 实现 PageRank
PageRank 算法 作为 Google 最早的一个网页排名算法,该算法在早期的搜索引擎中是搜索结果最为准确的,同时也是 Google 发家的一个重要算法.尽管这些年来该算法不再是 Google ...
- Skywalking(8.7)安装以及docker镜像打包
Skywalking安装以及docker镜像打包 Skywalking版本:apache-skywalking-apm-es7-8.7.0 ES版本:7.17.2 一.下载Skywalking的安装包 ...