設有n個正整數(n≤20),將它們聯接成一排,組成一個最大的多位整數。
例如:n=3時,3個整數13,312,343聯接成的最大整數爲:34331213
又如:n=4時,4個整數7,13,4,246聯接成的最大整數爲:7424613
輸入輸出格式
輸入格式:
第一行,一個正整數n。
第二行,n個正整數。
輸出格式:
一個正整數,表示最大的整數
樣例:
設有n個正整數(n≤20),將它們聯接成一排,組成一個最大的多位整數。
例如:n=3時,3個整數13,312,343聯接成的最大整數爲:34331213
又如:n=4時,4個整數7,13,4,246聯接成的最大整數爲:7424613
輸入輸出格式
輸入格式:
第一行,一個正整數n。
第二行,n個正整數。
輸出格式:
一個正整數,表示最大的整數
輸入輸出樣例
<div>
#include
#include
#include
using namespace std;
string num[22];
int n;
void swap(int x,int y)
{
string a;
a=num[x];
num[x]=num[y];
num[y]=a;
}
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
cin>>num[i];
for(int i=1;i<=n;i++)
for(int j=1;j</div>
坑死了,第一次交比的是數字,才80分,淚奔
<pre name="code" class="html" style="color: rgb(81, 81, 81); font-size: 15px; font-weight: bold; line-height: 24px;"><img alt="哭" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/cry.gif" /><img alt="哭" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/cry.gif" /><img alt="大哭" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/wail.gif" /><img alt="大哭" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/wail.gif" />
<pre name="code" class="html" style="color: rgb(81, 81, 81); font-size: 15px; font-weight: bold; line-height: 24px;"><img alt="哭" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/cry.gif" /><img alt="哭" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/cry.gif" /><img alt="大哭" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/wail.gif" /><img alt="大哭" src="http://static.blog.csdn.net/xheditor/xheditor_emot/default/wail.gif" />
設有n個正整數(n≤20),將它們聯接成一排,組成一個最大的多位整數。
例如:n=3時,3個整數13,312,343聯接成的最大整數爲:34331213
又如:n=4時,4個整數7,13,4,246聯接成的最大整數爲:7424613
輸入輸出格式
輸入格式:
第一行,一個正整數n。
第二行,n個正整數。
輸出格式:
一個正整數,表示最大的整數
輸入輸出樣例
3 13 312 343
34331213