1 条题解
-
0
C++ :
#include <bits/stdc++.h> using namespace std; int main(){ int n,x,a[100],i; cin>>n; for(i = 0;i < n;i++){ cin>>a[i]; } sort(a,a+n); int p = 0; for(i = 0;i < n;i++){ if(a[i] != 0){ p = i; break; } } int t = a[0]; a[0] = a[p]; a[p] = t; for(i = 0;i < n;i++){ cout<<a[i]; } }
Python :
class Node: def __init__(self,id): self.id=id def __lt__(self,other): if str(self.id)+str(other.id)<str(other.id)+str(self.id): return True n=int(input()) s=list(map(int,input().split())) ling_num=s.count(0) s=[item for item in s if item>0] alist=list() for item in s: alist.append(Node(item)) alist.sort() print(alist[0].id,end="") print("0"*ling_num,end="") for i in range(1,len(alist)): print(alist[i].id,end="")
- 1
信息
- ID
- 2372
- 时间
- 1000ms
- 内存
- 32MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者