CF-Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)-B-Valued Keys
来源:互联网 发布:wish产品怎么优化 编辑:程序博客网 时间:2024/06/01 09:40
ACM模版
描述
题解
十分简单的一道水题,看懂题就能秒,不用多一丝一毫的犹豫。
这是一个特判问题,已知f(x, y) = min(x, y) = z
,这里给定两个字符串x
和z
,求y
,y
的结果不唯一,其实,除去-1
的情况,直接让y = z
输出也是没问题的,说到-1
的情况,当出现z
的值比x
还小时,就直接 GG。
代码
#include <iostream>#include <string>using namespace std;int main(int argc, const char * argv[]){ string s1, s2; while (cin >> s1 >> s2) { string res = s2; int flag = 0; for (int i = 0; i < s1.length(); i++) { if (res[i] > s1[i]) { flag = 1; break; } } if (flag) { cout << "-1\n"; continue; } cout << res << '\n'; } return 0;}
0 0
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) B. Valued Keys
- CF-Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)-B-Valued Keys
- CF-Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)-A-Vicious Keyboard
- CF-Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)-C-Voltage Keepsake
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) A -- D
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) A. Vicious Keyboard
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) C. Voltage Keepsake
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) D. Volatile Kite
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)-C. Voltage Keepsake
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2) ABCD
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)
- 【解题报告】Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)
- Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1)
- Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1) 菜鸡只会ABC!
- Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1)
- 【解题报告】Codeforces Round #405 (rated, Div. 2, based on VK Cup 2017 Round 1)
- 【机器学习】生成模型和判别模型
- maven在eclipse中的配置(步骤)
- 【HomeBack】酷市场主题风格切换的简单实现
- 如何用Consul打造弹性可扩展的PaaS平台
- ssh公钥密钥无密码登陆
- CF-Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)-B-Valued Keys
- 新手ps做校园活动海报
- ACM-动态规划19-最低通行费
- Cmake “cmake_make_program is not set” 问题。
- java中this的用法简介
- 仿arrow.io之人物属性
- Linux C编程之IO-文件拷贝
- VS2013-切分对话框
- Python学习之元组