当前位置:网站首页>[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;
} 边栏推荐
- 【暑期每日一题】洛谷 P2026 求一次函数解析式
- Take a cold bath
- Pytoch (IV) -- visual tool visdom
- STM32扩展版 按键扫描
- 科研狗可能需要的一些工具
- 2022 a special equipment related management (elevator) simulation test and a special equipment related management (elevator) certificate examination
- 神经网络的基本骨架-nn.Moudle的使用
- FileInputStream
- Neural networks - use sequential to build neural networks
- LM small programmable controller software (based on CoDeSys) note 19: errors do not match the profile of the target
猜你喜欢

神经网络的基本骨架-nn.Moudle的使用

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

技术分享| 融合调度中的广播功能设计
![[hard ten treasures] - 2 [basic knowledge] characteristics of various topological structures of switching power supply](/img/c2/6dfb9f477306edb46ff2a6a6ca32dd.png)
[hard ten treasures] - 2 [basic knowledge] characteristics of various topological structures of switching power supply

数据加载及预处理

LM小型可编程控制器软件(基于CoDeSys)笔记十九:报错does not match the profile of the target

The longest increasing subsequence and its optimal solution, total animal weight problem

RuntimeError: “max_pool2d“ not implemented for ‘Long‘

先有网络模型的使用及修改

分布式-总结列表
随机推荐
神经网络-使用Sequential搭建神经网络
神经网络-最大池化的使用
Pytorch(三) —— 函数优化
LM small programmable controller software (based on CoDeSys) note 20: PLC controls stepping motor through driver
科研狗可能需要的一些工具
Shell之Unix运维常用命令
【暑期每日一题】洛谷 P1629 邮递员送信(未完待续...)
About the transmission pipeline of stage in spark
Summary of acl2021 information extraction related papers
pytorch 卷积操作
RuntimeError: mean(): input dtype should be either floating point or complex dtypes.Got Long instead
LM小型可编程控制器软件(基于CoDeSys)笔记二十:plc通过驱动器控制步进电机
对象的序列化与反序列化
How to do the performance pressure test of "Health Code"
pytorch神经网络搭建 模板
[hard ten treasures] - 1 [basic knowledge] classification of power supply
Difficulties in the development of knowledge map & the importance of building industry knowledge map
JS to solve the problem of floating point multiplication precision loss
LeetCode_66(加一)
Software testing needs more and more talents. Why do you still not want to take this path?