当前位置:网站首页>[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;
} 边栏推荐
- js解决浮点数相乘精度丢失问题
- Thoughts on the construction of Meizhou cell room
- RuntimeError: “max_pool2d“ not implemented for ‘Long‘
- 先有网络模型的使用及修改
- Leecode question brushing record 1332 delete palindrome subsequence
- LM small programmable controller software (based on CoDeSys) note 20: PLC controls stepping motor through driver
- LeetCode_ 35 (search insertion position)
- 【暑期每日一题】洛谷 P1629 邮递员送信(未完待续...)
- LeetCode_66(加一)
- STM32扩展版 按键扫描
猜你喜欢

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

分布式-总结列表

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

Pytorch(三) —— 函数优化

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

Applications and features of VR online exhibition

2022 tea master (intermediate) examination question bank and tea master (intermediate) examination questions and analysis

Dataloader的使用

Pytorch(一) —— 基本语法
随机推荐
LeetCode_28(实现 strStr())
The longest increasing subsequence and its optimal solution, total animal weight problem
Technology sharing | broadcast function design in integrated dispatching
[godot] unity's animator is different from Godot's animplayer
LeetCode_ 28 (implement strstr())
线程安全问题
LeetCode_ 53 (maximum subarray and)
神经网络-非线性激活
【暑期每日一题】洛谷 P1568 赛跑
CF1638E. Colorful operations Kodori tree + differential tree array
Overview of the construction details of Meizhou veterinary laboratory
[pat (basic level) practice] - [simple simulation] 1064 friends
Summary of acl2021 information extraction related papers
RuntimeError: mean(): input dtype should be either floating point or complex dtypes.Got Long instead
数据加载及预处理
Pytorch convolution operation
[hard ten treasures] - 2 [basic knowledge] characteristics of various topological structures of switching power supply
LeetCode_58(最后一个单词的长度)
洗个冷水澡吧
神经网络-最大池化的使用