SRM 583 Div II Level One:SwappingDigits
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12609
#include <iostream>
#include <string> using namespace std; string minstr = ""; class SwappingDigits
{
public: string minNumber(string num);
}; string SwappingDigits::minNumber(string num)
{
string temp;
string mins = "";
for (int i = 0; i < num.size()-1; i++) {
for (int j = i+1; j < num.size(); j++) {
temp = num;
swap(temp[i], temp[j]);
if (temp[0] != '0' && mins == "") {
mins = temp;
} else {
if (temp[0] != '0' && temp < mins) {
mins = temp;
}
}
}
} return mins;
}
SRM 583 Div II Level One:SwappingDigits的更多相关文章
- SRM 583 Div II Level Three:GameOnABoard,Dijkstra最短路径算法
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12556 用Dijkstra实现,之前用Floyd算法写了一个, ...
- SRM 582 Div II Level One: SemiPerfectSquare
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12580 比较简单,代码如下: #include <ios ...
- SRM 582 Div II Level Three: ColorTheCells, Brute Force 算法
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12581 Burte Force 算法,求解了所有了情况,注意 ...
- SRM 223 Div II Level Two: BlackAndRed,O(N)复杂度
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=3457&rd=5869 解答分析:http://comm ...
- SRM 207 Div II Level Two: RegularSeason,字符串操作(sstream),多关键字排序(操作符重载)
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=2866&rd=5853 主要是要对字符串的操作要熟悉,熟 ...
- SRM 582 Div II Level Two SpaceWarDiv2
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12556 #include <iostream> # ...
- SRM 219 Div II Level One: WaiterTipping,小心约分
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12609&rd=15503 这题目看上去so easy, ...
- SRM 212 Div II Level One: YahtzeeScore
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=1692&rd=5858 比较简单. 代码如下: #inc ...
- SRM 212 Div II Level Two: WinningRecord,Brute Force
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=3003&rd=5858 比较简单. 代码如下: #inc ...
随机推荐
- css3属性——border-radius用法
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <style> ...
- 史上最详细的Android Studio系列教程一--下载和安装
链接地址:http://segmentfault.com/a/1190000002401964#articleHeader4 原文链接:http://stormzhang.com/devtools/2 ...
- rotatelogs分割apache日志文件
rotatelogs 截断日志,进行配置.但是保存httpd.conf 之后,服务器报错: 日志文件: piped log program ' /usr/sbin/rotatelogs logs/py ...
- Python之路 Day12
day12主要内容:html基础.CSS基础 HTML HTML概述: HTML是英文Hyper Text Mark-up Language(超文本标记语言)的缩写,他是一种制作万维网页面标准语言(标 ...
- lnmp-zabbix
wget http://down1.chinaunix.net/distfiles/freetype-2.4.7.tar.bz2 tar -jxvf freetype-2.4.7.tar.bz2 cd ...
- Executor框架
Executor框架是指java5中引入的一系列并发库中与executor相关的功能类,包括Executor.Executors.ExecutorService.CompletionService. ...
- onekey_fourLED
也许我们刚开始用到开发板的时候都会去做跑马灯的程序,后来给我们的要求是,如果硬件接口有限制,只有一个key 或者是button—— 我们的板子上是button,让你用一个button去控制这四个led ...
- Calling 64-bit assembly language functions lodged inside the Delphi source code
Code: http://www.atelierweb.com/calling-64-bit-assembly-language-functions-lodged-inside-the-delphi- ...
- BZOJ 2599 [IOI2011]Race【Tree,点分治】
给出N(1 <= N <= 200000)个结点的树,求长度等于K(1 <= K <= 1000000)的路径的最小边数. 点分治,这道题目和POJ 2114很接近,2114是 ...
- Smarty - 安装+入门小例子
环境: smarty 1.在http://www.smarty.net/download下载最新smarty包,window选择zips,linux下选择tar.gz.以windows为例,下载后解压 ...