当前位置:网站首页>[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;
} 边栏推荐
- Common interview questions ①
- Data loading and preprocessing
- Pytoch (I) -- basic grammar
- Advanced application of ES6 modular and asynchronous programming
- Leecode record 1351 negative numbers in statistical ordered matrix
- Construction of Meizhou nursing laboratory: equipment configuration
- pytorch中常用数据集的使用方法
- Basic exercise of test questions hexadecimal to decimal
- 【暑期每日一题】洛谷 P5740【深基7.例9】最厉害的学生
- 2022 a special equipment related management (elevator) simulation test and a special equipment related management (elevator) certificate examination
猜你喜欢
![[godot] unity's animator is different from Godot's animplayer](/img/51/48f40a7b6736d7f78040eabbbd3395.jpg)
[godot] unity's animator is different from Godot's animplayer

STM32 photoresistor sensor & two channel AD acquisition

Difficulties in the development of knowledge map & the importance of building industry knowledge map

STM32扩展板 温度传感器和温湿度传感器的使用

RuntimeError: mean(): input dtype should be either floating point or complex dtypes.Got Long instead

Dede collection plug-in does not need to write rules

Measurement of quadrature axis and direct axis inductance of three-phase permanent magnet synchronous motor

C - detailed explanation of operators and summary of use cases

2022 G2 power station boiler stoker examination question bank and G2 power station boiler stoker simulation examination question bank

【硬十宝典】——1.【基础知识】电源的分类
随机推荐
【暑期每日一题】洛谷 P5886 Hello, 2020!
2022 a special equipment related management (elevator) simulation test and a special equipment related management (elevator) certificate examination
LeetCode_58(最后一个单词的长度)
最长递增子序列及最优解、动物总重量问题
RuntimeError: “max_pool2d“ not implemented for ‘Long‘
[2020 overview] overview of link prediction based on knowledge map embedding
[pat (basic level) practice] - [simple simulation] 1064 friends
Talk about testdeploy
Pytorch(四) —— 可视化工具 Visdom
Pytoch (II) -- activation function, loss function and its gradient
FileInputStream
VIM easy to use tutorial
LeetCode_ 28 (implement strstr())
Take a cold bath
[godot] unity's animator is different from Godot's animplayer
Common methods in transforms
神经网络-卷积层
STM32扩展板 数码管显示
Pytorch convolution operation
Pytest automated testing - compare robotframework framework