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 ...
随机推荐
- 初探webpack之单应用多端构建
初探webpack之单应用多端构建 在现代化前端开发中,我们可以借助构建工具来简化很多工作,单应用多端构建就是其中应用比较广泛的方案,webpack中提供了loader与plugin来给予开发者非常大 ...
- 我最喜欢的白版应用,AI加持的新功能开源!强烈推荐
Excalidraw 把他们的文本到图表的功能开源了 Excalidraw是一个虚拟白板应用,专门用于绘制类似手绘的图表.它提供了一个无限的.基于画布的白板,具有手绘风格,支持多种功能. 之前我分享的 ...
- 悲观锁、乐观锁、mybatis-plus实现乐观锁
悲观锁.乐观锁.mybatis-plus实现乐观锁 转载自:www.javaman.cn 1.悲观锁.乐观锁 乐观锁和悲观锁是两种用于处理并发操作的数据锁定策略.它们在处理多个事务尝试同时访问和修改同 ...
- 可视化学习:WebGL的基础使用
引言 继续复习可视化的学习.WebGL和其他Web端的图形系统存在很大的不同,是OpenGL ES规范在浏览器的实现,它最大的不同就在于它更接近底层,可以由开发者直接操作GPU来实现绘图,性能很好,可 ...
- 【软件安装】vmware虚拟机安装完整教程(15.5版本)
目录 一.基础介绍 二.准备工作(注意:如果自己下载不下来翻到最下面获取下载地址) 三.VMware下载与安装 VMware Workstation15.5新功能 注意: 一.基础介绍 VMware ...
- AtomicArray
AtomicInteger ai = new AtomicInteger(1); //1.获取值 System.out.println("ai.get = "+ai.get()); ...
- HDU-2159 二维背包
最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务.久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级.现在的问题是,xhd升掉最后一级还需n的经 ...
- Pikachu漏洞靶场 敏感信息泄露
敏感信息泄露 概述 由于后台人员的疏忽或者不当的设计,导致不应该被前端用户看到的数据被轻易的访问到. 比如: 通过访问url下的目录,可以直接列出目录下的文件列表; 输入错误的url参数后报错信息里面 ...
- .net Core实战简单文件服务器
首先新建一个ASP.NET Core 项目,选中空的模板,如下图所示 在NuGet包中添加Microsoft.AspNetCore.StaticFiles 添加好以后我们在Startup.cs中添加对 ...
- libGDX游戏开发之菜单界面(四)
libGDX游戏开发之菜单界面(四) libGDX系列,游戏开发有unity3D巴拉巴拉的,为啥还用java开发?因为我是Java程序员emm-国内用libgdx比较少,多数情况需要去官网和googl ...