SRM 583 Div II Level One:SwappingDigits
2013-06-23 16:44
549 查看
题目来源: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 219 Div II Level One: WaiterTipping,小心约分
- SRM 207 Div II Level One: TransportCounting
- SRM 583 Div II Level Three:GameOnABoard,Dijkstra最短路径算法
- SRM 219 Div II Level One: WaiterTipping,小心约分
- SRM 212 Div II Level One: YahtzeeScore
- SRM 222 Div II Level One: TextCompressor,求最大重复子串问题
- SRM 582 Div II Level One: SemiPerfectSquare
- SRM 583 Div II Level Three:GameOnABoard,Dijkstra最短路径算法
- SRM 299 Div II Level Two: Projections
- SRM 577 Div II Level Two: EllysRoomAssignmentsDiv2
- SRM 586 Div II Level Three: StringWeightDiv2,Dynamic Programming or Math
- SRM 222 Div II Level Two: GroceryBagger,STL map 用法
- Topcoder SRM 583 DIV2 SwappingDigits
- SRM 207 Div II Level Two: RegularSeason,字符串操作(sstream),多关键字排序( 比较函数 )
- SRM 223 Div II Level Two: BlackAndRed,O(N)复杂度
- SRM 207 Div II Level Three: CaptureThemAll,BFS算法
- SRM 578 Div II Level Two: GooseInZooDivTwo, DFS
- SRM 219 Div II Level Two: HealthFood
- SRM 579 Div II Level Two: UndoHistory
- SRM 578 Div II Level Three: WolfInZooDivTwo,Dynamic Programming,求教!