题目来源: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的更多相关文章

  1. SRM 583 Div II Level Three:GameOnABoard,Dijkstra最短路径算法

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12556 用Dijkstra实现,之前用Floyd算法写了一个, ...

  2. SRM 582 Div II Level One: SemiPerfectSquare

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12580 比较简单,代码如下: #include <ios ...

  3. SRM 582 Div II Level Three: ColorTheCells, Brute Force 算法

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12581 Burte Force 算法,求解了所有了情况,注意  ...

  4. SRM 223 Div II Level Two: BlackAndRed,O(N)复杂度

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=3457&rd=5869 解答分析:http://comm ...

  5. SRM 207 Div II Level Two: RegularSeason,字符串操作(sstream),多关键字排序(操作符重载)

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=2866&rd=5853 主要是要对字符串的操作要熟悉,熟 ...

  6. SRM 582 Div II Level Two SpaceWarDiv2

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12556 #include <iostream> # ...

  7. SRM 219 Div II Level One: WaiterTipping,小心约分

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12609&rd=15503 这题目看上去so easy, ...

  8. SRM 212 Div II Level One: YahtzeeScore

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=1692&rd=5858 比较简单. 代码如下: #inc ...

  9. SRM 212 Div II Level Two: WinningRecord,Brute Force

    题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=3003&rd=5858 比较简单. 代码如下: #inc ...

随机推荐

  1. PPTPD服务端搭建

    http://www.360doc.com/content/14/0304/09/15165033_357558764.shtml . apt-get update; apt-get install ...

  2. [Swust OJ 1084]--Mzx0821月赛系列之情书(双线程dp)

    题目链接:http://acm.swust.edu.cn/problem/1084/ Time limit(ms): 1000 Memory limit(kb): 65535   Descriptio ...

  3. ASP.NET MVC 5 学习教程:添加视图

    原文 ASP.NET MVC 5 学习教程:添加视图 起飞网 ASP.NET MVC 5 学习教程目录: 添加控制器 添加视图 修改视图和布局页 控制器传递数据给视图 添加模型 创建连接字符串 通过控 ...

  4. (step7.2.4)hdu 2674(N!Again——简单数论)

    题目大意:输入一个整数n,输出N! mod 2009 的结果. 解题思路: 1)任意数  n = ( n / 2009) * 2009 + n % 2009 2)40!  mod 2009  等于 2 ...

  5. Android常用动画alpha和rotate同时使用

    Android的动画可以是一种动画,也可以多种动画作用于一张图片上,如RotaeAnimation和AlphaAnimation同时放到一个配置文件中 alpha1.xml <?xml vers ...

  6. C# 课堂总结4-类(常用的类)

    一.string类 1. str.Length:字符串的长度 *****str[索引号] 2. str.Trim():去除左右两边的空格 *****str.TrimStart():去掉左边的空格str ...

  7. 第三届蓝桥杯 c/c++真题

    第三届蓝桥杯真题 c/c++ 以下题目我自己也并不是所有的题目都是一次性就能做对或是有结题思路的.有些题目也是经过查证网上相关的资料或是参考了别人的代码和解题思路才做出来的.总的来看,这份题目考了很多 ...

  8. OJ双人赛:程序设计竞赛的新尝试

    早就想在所教的班上组织一次程序设计竞赛,直到冒出双人赛形式的念头.出题.分组.竞赛,又是一次新的尝试. 做为在教学环节中组织的竞赛,不同于自愿报名的竞赛,必须全员参与.享受比赛要追求,培养团队意识也要 ...

  9. java--继承的一些笔记

    public class Person { public void display(){ System.out.println("Play Person..."); } stati ...

  10. KestrelServer

    KestrelServer 跨平台是ASP.NET Core一个显著的特性,而KestrelServer是目前微软推出了唯一一个能够真正跨平台的Server.KestrelServer利用一个名为Ke ...