UVa 10905 Children's Game
字串。。。直接排序(如果用字元陣列儲存不便於排序)
#include<cstdio> #include<cstring> #include<iostream> #include<cstdlib> #include<vector> #include<queue> #include<stack> #include<algorithm> using namespace std; bool com(string a,string b) { return(a+b>a+b); } int n; int main() { while((scanf("%d",&n))==1&&n!=0) { string s[n]; for(int i = 0;i<n;i++) cin>>s[i]; sort(s,s+n,com); for(int i=0;i<n-1;i++) cout<<s[i]; cout<<s[n-1]<<endl; } return 0; }
相關推薦
UVa 10905 Children39;s Game
字串。。。直接排序(如果用字元陣列儲存不便於排序) #include<cstdio> #include<cstring> #include<iostream> #include<cstdlib> #include<vec
UVa 10905 - Children39;s Game 排序,題目沒有說輸入是int 難度: 0
user oca output div code out freopen algorithm option 題目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&p
hdu1525 Euclid's Game , 基礎博弈
post rac 題意 mod 基礎 pan pro game -s http://acm.hdu.edu.cn/showproblem.php?pid=1525 題意: 兩人博弈,給出兩個數a和b, 較大數減去較小數的隨意倍數。結果不能小於0,將兩個數隨
HDU - 2147 kiki39;s game
return to do hat won first appears perf art pear Recently kiki has nothing to do. While she is bored, an idea appears in his mind, she ju
HDU 1517: kiki39;s game
hat author have pro mil exti -1 until .cn /** * @link http://acm.hdu.edu.cn/showproblem.php?pid=1517 * @author Sycamore * @date Aug, 21 *
HDU 5643 King39;s Game | 約瑟夫環變形
printf for hdu bsp esp ret inf color long 經典約瑟夫環 1 int f[N] ={ 0 }; 2 for(int i=2; i<=n; i++) 3 { 4 f[i] = (f[i-1] + k) %
POJ 2348 Euclid39;s Game(輾轉相除博弈+自由度分析)
main -1 發現 轉移 pro b- color 思路 span 題目鏈接:http://poj.org/problem?id=2348 題目大意:給你兩個數a,b,Stan和Ollie輪流操作,每次可以將較大的數減去較小的數的整數倍,相減後結果不能小於0,誰先將其中
博弈論入門題 kiki39;s game
unsigned str ram right scan logs sel include otto Problem Description Recently kiki has nothing to do. While she is bored, an idea appear
【POJ】2348 Euclid39;s Game
情況 either play cond ive class 個人 lines always Description Two players, Stan and Ollie, play, starting with two natural numbers. Stan, the
Codeforces 835E The penguin39;s game
quest rate 2個 lin c++ nat first ng- verdi Pay attention: this problem is interactive. Penguin Xoriy came up with a new game rece
HDU 2147 kiki39;s game
pac fec 棋盤 每次 contains ace sample rst include Problem Description Recently kiki has nothing to do. While she is bored, an idea appears i
UVA 10815 -- Andy39;s First Dictionary
gpo esp std sign sig left set post 圖片 sample input Adventures in Disneyland Two blondes were going to Disneyland when they came to a
UVA 816 -- Abbott39;s Revenge(BFS求最短路)
sid 結果 bool 迷宮問題 inf ios walk cstring solution UVA 816 -- Abbott‘s Revenge(BFS求最短路) 有一個 9 * 9 的交叉點的迷宮。 輸入起點, 離開起點時的朝向和終點, 求最短路(多解時任意一個
UVa 658 - It39;s not a Bug, it39;s a Feature!(Dijkstra + 隱式圖搜索)
index else bug class string 最短 enc 字符串表 字符串 鏈接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_p
POJ 2348 Euclid39;s Game(博弈)題解
tac pan tps 題意 \n sin typedef esp cstring 題意:有a,b兩個數字,兩人輪流操作,每次可以選擇兩個之中較小的數字,然後另一個數字減去選擇數字的任意倍數(不能減到負數),直到其中一個為0,不能操作為敗 思路:這題用博弈NP思想,必敗點和
UVA-10817- Headmaster39;s Headache(狀壓DP)
UVA-10817- Headmaster's Headache 題意: 這間學校開設S門課,給出校長已經有的師資n,然後再給出m個應聘者,每門課至少有兩名任課老師,求最少需要的僱傭工資。 分析: 這個題的輸入很奇怪,每個人的資訊輸入在一行上,不能簡單地讀取,需要用字串處理操作。 已經有的師資是肯定
[HDU3544] Alice39;s Game(網上有些講解是錯的)
文章目錄 [HDU3544] Alice's Game 題意: 分析: 參考程式碼 初級 簡化 [HDU3544] Alice’s G
UVA - 816 Abbott39;s Revenge (BFS求最短路並列印路徑)
The 1999 World Finals Contest included a problem based on a dice maze. At the time the problem was written, the judges were unable to discover t
HDU 3544Alice39;s Game 【不平等博弈)】
Alice and Bob have got a lot of chocolates. All the chocolates are rectangles of different shapes as X i * Y i.They decide to
HDU1525 Euclid39;s Game 【歐幾里得博弈】
有兩個玩家,Stan 和 Ollie, 在玩遊戲。初始有兩個自然數。Stan是先手,每次把大的數字減去小的數字的任意倍數,但是不能使數字變成負數。然後Ollie進行同樣的操作,直到有一個玩家使一個數字變為零。 例如,初始時數字為(25,7): 25 7 11 7 4 7 4 3 1 3 1 0 這樣