当前位置:网站首页>[daily question in summer] function of rogu p3742 UMI
[daily question in summer] function of rogu p3742 UMI
2022-07-01 04:47:00 【AC_ Dragon】
Topic link :P3742 umi Function of - Luogu | New ecology of computer science education (luogu.com.cn)
Background
umi Found a mysterious function f.
Title Description
This function accepts two strings s1,s2. These strings can only be composed of lowercase letters , And have the same length . The output of this function is another length and s1,s2 The same string g.g Of the i Characters equal to s1 Of the i Characters and s2 Of the i Minimum of characters , Simply speaking ,g[i]=min(s1[i],s2[i]).
for example :f("ab","ba")= "aa", f("nzwzl","zizez")="niwel".
She now has two strings of the same length with only lowercase letters x,y. Find any satisfaction f(x,z)=y Of
character string z. If you can't find such a string , Please export -1.
Input format
The first line gives the length of the following two strings n.
The second line gives a string x.
The third line gives a string y.
Output format
The first line outputs a string , Represents the qualified string you find . If you can't find it , Please export -1.
Examples #1
The sample input #1
2
ab
aaSample output #1
baExamples #2
The sample input #2
5
nzwzl
niwelSample output #2
xiyezExamples #3
The sample input #3
2
ab
baSample output #3
-1Tips
about 100% The data of ,1<=n<=100.
AC code:
#include<iostream>
using namespace std;
int main()
{
int l;
cin>>l;
string s1,s2;
cin>>s1>>s2;
for(int i=0;i<l;i++)
{
if(s2[i]>s1[i])
{
cout<<-1;
return 0;
}
}
cout<<s2;
return 0;
} 边栏推荐
猜你喜欢

Daily algorithm & interview questions, 28 days of special training in large factories - the 13th day (array)

PR 2021 quick start tutorial, learn about the and functions of the timeline panel

LM小型可编程控制器软件(基于CoDeSys)笔记二十:plc通过驱动器控制步进电机

Tencent has five years of testing experience. It came to the interview to ask for 30K, and saw the so-called software testing ceiling

Neural network convolution layer

Applications and features of VR online exhibition

VIM easy to use tutorial

RuntimeError: “max_pool2d“ not implemented for ‘Long‘

Pytorch(一) —— 基本语法
![AssertionError assert I.ndim == 4 and I.shape[1] == 3](/img/b1/0109bb0f893eb4c8915df36c100907.png)
AssertionError assert I.ndim == 4 and I.shape[1] == 3
随机推荐
线程类的几大创建方法
Codeworks round 449 (Div. 1) C. Kodori tree template
Pytoch (II) -- activation function, loss function and its gradient
How to use common datasets in pytorch
2022 G2 power station boiler stoker examination question bank and G2 power station boiler stoker simulation examination question bank
RuntimeError: “max_pool2d“ not implemented for ‘Long‘
扩展-Fragment
Codeforces Round #771 (Div. 2) ABCD|E
STM32 光敏电阻传感器&两路AD采集
科研狗可能需要的一些工具
C#读写应用程序配置文件App.exe.config,并在界面上显示
Technology sharing | broadcast function design in integrated dispatching
洗个冷水澡吧
手动实现一个简单的栈
Talk about testdeploy
All in all, the low code still needs to solve these four problems
pytorch中常用数据集的使用方法
解决:Thread 1:[<*>setValue:forUndefinedKey]:this class is not key value coding-compliant for the key *
STM32扩展板 温度传感器和温湿度传感器的使用
Research on medical knowledge atlas question answering system (I)