B. Equidistant String

告别手动解析!用这个Qt库轻松处理Cat 21/62等18种Asterix航空数据 本文介绍了基于Qt框架的高效Asterix报文解析库,帮助开发者轻松处理Cat 21/62等18种航空数据。该库通过协议抽象化、多维度API设计和跨平台支持,解决了手动解析的复杂性和易错问题,显著提升开发效率和系统可靠性。 阅读详情
B. Equidistant String
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings contain only digits zero and one. She uses the definition of Hamming distance:

We will define the distance between two strings s and t of the same length consisting of digits zero and one as the number of positions i, such that si isn't equal to ti.

As besides everything else Susie loves symmetry, she wants to find for two strings s and t of length n such string p of length n, that the distance from p to s was equal to the distance from p to t.

It's time for Susie to go to bed, help her find such string p or state that it is impossible.

Input

The first line contains string s of length n.

The second line contains string t of length n.

The length of string n is within range from 1 to 105. It is guaranteed that both strings contain only digits zero and one.

Output

Print a string of length n, consisting of digits zero and one, that meets the problem statement. If no such string exist, print on a single line "impossible" (without the quotes).

If there are multiple possible answers, print any of them.

Sample test(s)
input
0001
1011
output
0011
input
000
111
output
impossible
Note

In the first sample different answers are possible, namely — 0010, 0011, 0110, 0111, 1000, 1001, 1100, 1101.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<stdio.h>
#include<string.h>
#define N 100010

char s1[N], s2[N];

int main()
{
    int len;
    while(~scanf("%s%s", s1, s2))
    {
        int k=2, t=0;
        len=strlen(s1);
        for(int i=0;i<len;i++)
        {
            if(s1[i]!=s2[i])
            {
                t++;
            }
        }
        if(t%2!=0)
        {
            printf("impossible\n");
            continue;
        }
        for(int i=0;i<len;i++)
        {
            if(s1[i]==s2[i])
                printf("0");
            else
            {
                if(k%2)
                    printf("%c", s1[i]);
                else
                    printf("%c", s2[i]);
                k++;
            }
        }
        printf("\n");
    }
    return 0;
}
LabVIEW波形图表时间轴设置:三种方法实现横坐标显示日期时间 在数据采集与设备监控场景中,波形图表的横坐标默认显示采样点序号而非日期时间,这给工程师分析历史数据带来不便。理解时间标识(Timestamp)的本质——一个自1904年起算的双精度秒数,是解决问题的关键。时间轴设置既是显示格式问题,更是数据层与显示层的协同设计。通过属性节点动态生成刻度标签、将时间标识数组直接作为X轴数据、或使用波形数据(Waveform)类型绑定t0与dt,分别适用于固定点数显示、非等间隔事件记录和等间隔连续采样等不同需求。合理选择方案并注意缓冲区预分配与时间连续性处理,可让波形图表准确呈 阅读详情

相关推荐

安川机器人SOCKET 通讯

命令 功能 参数 示例 返回 SelectJob 选择程序 JobName LineNo SelectJob TEST 0 #SelectJob,Ok StartJob 启动程序 JobName StartJob TEST #StartJob,Ok Pause 暂停当前程序 - Pause #Pause,Ok Continue 继续当前程序 - Continue #Continue,Ok ServoOn 伺服上电 - ServoOn #ServoOn,Ok ServoOf...

记录学习内容 8285

codeforces 545B Equidistant String

codeforces 545B Equidistant String We will define the distance between two strings s and t of the same length consisting of digits zero and one as the number of positions i, such that si isn't equal to ti.

更好体验→ https://x-blankspace.github.io/ 809

word2vector入门教程

摘要: 网上已经有许多对w2v的介绍了,这里只是做一个简单的概括。下面这篇文章我认为是关于W2V写的比较好的文章,读者有兴趣可以先参考一下: w2v参考文章1 另外一篇是关于Skip-Gram和CBow的介绍。 Skip-Gram&CBOW 逻辑比较清晰的综述文章: 综述文章 数学原理很清晰很短的一篇文章(也有关于负采样的简单说明) 参考文章 1.什么

SCUT_Sam 1万+

Equidistant String

Equidistant String Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings contain only digits zero and one. She uses the definition of...

Smi_l_e_的博客 360

手把手教你用示波器测试DDR5 DRAM信号完整性(附眼图分析技巧)

本文详细介绍了如何使用示波器测试DDR5 DRAM信号完整性,包括眼图分析技巧。从DDR5的核心挑战、测试设备选型到实测工作流程,提供了全面的指导。特别强调了DFE功能验证和系统级协同测试,帮助工程师解决信号完整性问题,提升测试效率。

g2h3i4j5的博客 1155

手把手教你用Trae配置Python开发环境(含Claude 3.5代码生成实战)

本文详细介绍了如何使用字节跳动推出的Trae智能开发环境配置Python开发环境,并实战演示了Claude 3.5代码生成功能。从环境准备到项目初始化,再到AI辅助编码和调试优化,全面展示了Trae在提升开发效率方面的强大能力,特别适合Python开发者快速搭建项目和解决复杂问题。

weixin_28309571的博客 977

周赛-Equidistant String 分类: 比赛 ...

time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie loves strings. Today she calculates distances between them. ...

weixin_30408309的博客 157

LWIP协议栈在STM32H7上的内存优化实战:如何用32KB RAM实现稳定千兆以太网通信

本文深入探讨了在STM32H7微控制器上,如何通过内存优化策略,在仅32KB的D2 SRAM中稳定运行LWIP协议栈以实现千兆以太网通信。文章详细分析了STM32H7的内存架构、LWIP的内存消耗瓶颈,并提供了从描述符表与PBUF池精确分配、链接脚本修改到MPU区域划分的一整套实战优化方案,旨在解决大数据量传输卡死等常见配置问题。

gg901的博客 604

CodeForces - 545B Equidistant String 构造

题目链接:点击查看 Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings contain only digits zero and one. She uses the definition of Hamming...

还我笑颜 342

【国民技术N32项目移植】基于 Windows 的 ARM GCC 开发环境

【国民技术N32项目移植】基于 Windows 的 ARM GCC 开发环境

weixin_42150032的博客 1361

具身机器人内部PCB板分类与系统架构详解

本文系统梳理了机器人内部PCB板的功能架构,将其划分为5大模块:1)核心主板(含主控计算机板、实时控制板等);2)感知类PCB(视觉、听觉、触觉等);3)运动控制类PCB(伺服驱动、编码器等);4)电源与安全类PCB(电源管理、BMS等);5)通信类PCB(EtherCAT背板等)。通过人体器官类比(如大脑对应主控板、小脑对应实时控制板),详解了各模块的芯片选型、位置分布及协同关系,并给出信号/能量/指令的三流闭环示意图和典型系统参数(48V供电、1ms通信周期)。整体呈现了机器人"神经系统&qu

几十年资深高级架构师,技术专家的技术笔记。专注C、Java、Python、微服务、云原生、AI工程化及高并发系统分布式架构实战,分享源码剖析、性能调优与架构治理经验。 321

B - Equidistant String

B -Equidistant String Time Limit:1000MSMemory Limit:262144KB64bit IO Format:%I64d & %I64u Description Little Susie loves strings. Today she calculates distances between them...

weixin_30627381的博客 120

IgH EtherCAT 从入门到精通:第 3 章 第一次运行 Hello EtherCAT

摘要:启动EtherCAT主站实践指南 本章详细介绍了如何配置和启动EtherCAT主站系统,主要内容包括: 配置文件详解:讲解/etc/ethercat.conf中的关键配置项,包括主网卡指定、冗余备份设置和网卡驱动选择。 启动流程:说明通过systemd服务和手动命令两种方式加载内核模块,重点介绍了ec_master和ec_generic模块的加载顺序及验证方法。 命令行工具:列举ethercat工具的常用命令,如查看主站状态、扫描从站设备、读取PDO/SDO数据等。 示例程序:简要介绍内核态示例min

从事嵌入式linux android驱动开发,拥有全栈能力 311

CodeForces 545B Equidistant String

http://codeforces.com/problemset/problem/545/B Equidistant String Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings c

大太阳 872

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

545B Equidistant string

1、问题描述 2、仅贪心算法即可,由高位到低位逐位变化,并判断。#include <iostream> #include<cstring> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */ #define

daguge1的专栏 482

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

coderforce 545B. Equidistant String

题意:求一个字符串,使得他与S,T,相似度相差相等 #include #include #include using namespace std; const int maxm=1e5+10; char s1[maxm]; char s2[maxm]; char s3[maxm]; int main() { while(scanf("%s%s",s1,s2)!=EOF) {

小马的博客 510

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

CodeForces 545B Equidistant String (模拟)

【题目链接】:click here~~ 【题目大意】: 题意:求一个字符串,使得它与S,T,相似度相差相等。  【思路】:就是找出S,T之间的相差个数,相差为奇数,输出impossible。输出为偶数的话不同的前半部分输出S后半部分输出T就好了。 代码: /* * Problem: CodeForces 545B * Running time: 0MS * Complier:

herongwei 的 BLOG 1950

Codeforces Round #303B. Equidistant String

time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie loves strings. Today she calculates distances between them. As Susie is a smal...

★探梦少年☆的博客 250

Codeforces 545B Equidistant String【思维】

B. Equidistant String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie loves strings. Today she calculates

mengxiang000000 738

545B. Equidistant String

题目链接   输入两个只含有01的字符串,s,t 求一个字符串p使到s,t的距离一样 这里的距离是指对应位置:0-0的距离是0 ,o-1的距离是1 ,1-1的距离是0,1-0的距离是1 这里只要求找出满足条件的一个p既可以 对s,t相同位置一样的可以不考虑,因为这个是同时增加了p到两者的距离 下面就是只对相同位置不相同的情况考虑 交替的选取si,ti的位置的元素组成新的p   ...

weixin_33984032的博客 107

codeforces-303-B. Equidistant String-水题

给你2个01串,问能否构造出一个p串 使得 p与 2个给出的串 的 不相同 字母 的个数一样 首先 对s1、s2判断,对于他们相同的位置,p【i】不管是0还是1对结果都不影响 那么如果s1与s2不同的位置是偶数个,则p只要选一半和s1相同,一半与s2相同就可以了 如果为奇数,必定不合法 #include #include #include #include #include #

缺氧 420

Codeforces Round #303 (Div. 2)——B——Equidistant String

Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings contain only digits zero and one. She uses the definition of Hamming dis...

dgjm4087的博客 145

Codeforces Round #303 (Div.2)-B. Equidistant String(模拟)

B. Equidistant String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Susie loves strings. Today she

梧桐下的四叶草 675

http://codeforces.com/problemset/problem/545/B Equidistant String

只有s,t对应i位置不同时,才会产生一个距离差,于是想到每次先增大s的距离后增大t的距离,最后判断一下两个距离是否相等即可。 #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cstdio&gt; #include &lt;algorithm&gt; #include &lt;vector&gt; #include &l...

Jack_zhuiyi的博客 305
上一篇: A. DZY Loves Chessboard
下一篇: Task schedule
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值