CF1281B Azamon Web Services
思路:
贪心,找到将s至多交换一次所能得到的字典序最小的字符串,再与c比较。
实现:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n; cin >> n;
while (n--)
{
string s, c;
cin >> s >> c;
if (s < c) { cout << s << endl; continue; }
string t = s;
sort(t.begin(), t.end());
int n = s.length();
bool flg = false;
for (int i = ; i < n; i++)
{
if (flg) break;
if (s[i] != t[i])
{
for (int j = n - ; j > i; j--)
{
if (s[j] == t[i])
{
swap(s[i], s[j]); flg = true; break;
}
}
}
}
if (s < c) cout << s << endl;
else cout << "---" << endl;
}
return ;
}
CF1281B Azamon Web Services的更多相关文章
- CF 1281B Azamon Web Services
原题链接:http://codeforces.com/problemset/problem/1281/B 题目大意: 给你两个字符串 s 和 c ,最多经过一次变换,使s的字典序小于c,输出变换后的s ...
- .NET RESTful Web Services入门
很早之前看到过RESTful Web Services,并未在意,也没找相关资料进行学习.今天偶尔有一机会,就找了点资料进行研究,发现RESTful真是“简约而不简单”.下面用示例来说明: 1 项目结 ...
- 分分钟带你玩转 Web Services
当大型需求被数个公司分割开来,各公司系统相互交换数据的问题就会接踵而来. 毕竟是多家不同的公司的产品,研发开发语言.采用技术框架基本上是百花齐放. 怎样让自家系统提供的服务具有跨平台.跨语言.跨各种防 ...
- BizTalk发布WS-Security的web services
最近做个项目,biztalk跟OTM(Oracle Transportation Management)系统做对接,双方通过web services通讯,这部分是BizTalk发布WS-Securit ...
- BizTalk调用WS-Security的web services
最近做个项目,biztalk跟OTM(Oracle Transportation Management)系统做对接,双方通过web services通讯,这部分是BizTalk调用OTM的web se ...
- 【整理】动态加载Web Services
WebClient client = new WebClient(); String url = "http://localhost/MESAPIWebService/MESAPI.asmx ...
- RESTful Web Services初探
RESTful Web Services初探 作者:杜刚 近几年,RESTful Web Services渐渐开始流行,大量用于解决异构系统间的通信问题.很多网站和应用提供的API,都是基于RESTf ...
- asp.net Ajax和web services
新建一个web服务 using System; using System.Collections.Generic; using System.Linq; using System.Web; using ...
- SpringSide 部署showcase项目出现 JAX-RS (REST Web Services) 2.0 can not be installed错误!
maven+springmvc错误 JAX-RS (REST Web Services) 2.0 can not be installed 项目problem提示错误 JAX-RS (REST Web ...
随机推荐
- 系统字体放大导致rem布局错乱,解决方案,已通过测试
如果你用rem没遇到过坑,那只能说明你 too young too simple; (function (doc, win) { var resizeEvt = 'orientationchange' ...
- Codevs 1482 路线统计(矩阵乘法)
1482 路线统计 时间限制: 1 s 空间限制: 256000 KB 题目等级 : 钻石 Diamond 题目描述 Description N个节点的有向图, 求从start到finish刚好经过时 ...
- codevs 1792 分解质因数
1792 分解质因数 题目描述 Description 编写一个把整数N分解为质因数乘积的程序. 输入描述 Input Description 输入一个整数 N 输出描述 Output Descr ...
- 13、SparkContext详解
一.SparkContext原理 1.图解 二.SparkContext源码 1.TaskScheduler创建 ###SparkContext.scala // Create and start t ...
- 第12组 Alpha冲刺(2/6)
Header 队名:To Be Done 组长博客 作业博客 团队项目进行情况 燃尽图(组内共享) 展示Git当日代码/文档签入记录(组内共享) 注: 由于GitHub的免费范围内对多人开发存在较多限 ...
- 【Python 代码】3D TIF 拆成若干张tif (ISBI细胞数据集)
from libtiff import * imgdir = TIFF3D.open("train-labels.tif") imgarr = imgdir.read_image( ...
- Git的使用(5) —— 在IDEA上使用
1. 在IDEA中配置Git 前言:IDEA中鼓捣Git是真的费劲,建议还是用TortoiseGit. 打开IDEA的Settings,左侧菜单列表中的Version Control里面找到Git. ...
- Git的使用(1) —— 版本库
1. 简介 Git作为一个分布式版本控制系统,其优点是不需要一直连接远端版本库就可以使用. 故其为实现分布版本控制专门设计了一整套的存储区间和语句,用来实现. (1) 本地版本库:建立在本机磁盘上的文 ...
- ubuntu之路——day1(一点十五分 MMP终于把显卡装好了)
因为要上手深度学习的原因,购置了一台RTX2080TI+ubuntu18.04的机器 例行两条命令 sudo apt-get update sudo apt-get upgrade 开启巨坑第一天,以 ...
- C语言--二维数组
一.PTA实验作业 题目1:7-2 求整数序列中出现次数最多的数 1. 本题PTA提交列表 2. 设计思路 定义变量n表示输入整数个数,count表示每个数出现次数,i.j表示循环变量,k表示次数最多 ...