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 (思维)的更多相关文章

  1. 2019牛客多校第三场B Crazy Binary String 思维

    Crazy Binary String 思维 题意 给出01串,给出定义:一个串里面0和1的个数相同,求 满足定义的最长子序列和子串 分析 子序列好求,就是0 1个数,字串需要思考一下.实在没有思路可 ...

  2. [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 ...

  3. [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 ...

  4. [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 ...

  5. [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 ...

  6. [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 ...

  7. [LeetCode&Python] Problem 868. Binary Gap

    Given a positive integer N, find and return the longest distance between two consecutive 1's in the ...

  8. 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 ...

  9. codeforces 807 D. Dynamic Problem Scoring(贪心+思维)

    题目链接:http://codeforces.com/contest/807/problem/D 题意:对于动态计分的 Codeforces Round ,已知每题的 score 是根据 Round ...

  10. HDU - 6242 Geometry Problem (几何,思维,随机)

    Geometry Problem HDU - 6242 Alice is interesting in computation geometry problem recently. She found ...

随机推荐

  1. 一个Blazor+WinForm+MAUI+PDA实现的条码比对系统

    条码比对系统是由单机版桌面软件和Android版的PDA扫码软件组成,桌面软件采用Blazor与WinForm进行混合开发,PDA扫码软件采用MAUI进行开发,这个项目都是基于.NET技术进行构建,这 ...

  2. Java 21中的两个值得关注的Bug修复

    在Java 21中,除了推出很多新特性之外,一些Bug修复,也需要注意一下.因为这些改变可能在升级的时候,造成影响. Double.toString()和Float.toString()的精度问题修复 ...

  3. 使用Slurm集群进行分布式图计算:对Github网络影响力的系统分析

    本文分享自华为云社区<基于Slurm集群的分布式图计算应用实践:Github协作网络影响力分析>,作者:yd_263841138 . 1. 引言 Slurm(Simple Linux Ut ...

  4. STL常用函数

    STL简介 \(STL\)是\(Standard\) \(Template\) \(Library\)的简称,中文名称为标准模板库,从根本上讲, 就是各种\(STL\)容器的集合,容器可以理解为能够实 ...

  5. Redis 学习笔记2:持久化

    目录 1 什么是持久化 1.1 aof 1.2 rdb 2 RDB持久化 2.1 RDB 是什么 2.2 手动触发 3 AOF持久化 3.1 aof 是什么 3.2 appendfile 文件说明: ...

  6. 文心一言 VS 讯飞星火 VS chatgpt (159)-- 算法导论12.3 6题

    六.用go语言,当 TREE-DELETE 中的结点 z 有两个孩子时,应该选择结点 y 作为它的前驱,而不是作为它的后继.如果这样做,对 TREE-DELETE 应该做些什么必要的修改?一些人提出了 ...

  7. 基于一维卷积神经网络模型的AI量化智能选股策略

    这是早前BigQuant专题研究:基于卷积神经网络CNN的深度学习因子选股模型.卷积神经网络(Convolutional Neural Network, CNN),是计算机视觉研究和应用领域中最具影响 ...

  8. C++ 核心指南 —— 性能

    C++ 核心指南 -- 性能 阅读建议:先阅读 <性能优化的一般策略及方法> 截至目前,C++ Core Guidelines 中关于性能优化的建议共有 18 条,而其中很大一部分是告诫你 ...

  9. JS的对象

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  10. 【1】从零玩转OSS阿里云存储服务之阿里云平台等操作-1-cong-ling-wan-zhuan-oss-a-li-yun-cun-chu-fu-wu-zhi-a-li-yun-ping-tai-deng-cao-zuo

    title: [1]从零玩转OSS阿里云存储服务之阿里云平台等操作 date: 2021-06-09 17:21:12.037 updated: 2021-12-26 17:43:18.92 url: ...