Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RGB7581 - Тооноос бага тоо

Өгөгдсөн натурал тооны цифрүүдийг үүссэн тоо нь хамгийн бага байхаар сольж тавина уу.

Input

Натурал тоо өгөгдөнө. Long long төрөл.

Output

Цифрүүдээр нь үүсэх хамгийн бага натурал тоо.

Example

Input:
34032

Output:
20334

Нэмсэн:Bataa
Огноо:2013-02-06
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:ADA95 ASM32 BASH BF C NCSHARP CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO JULIA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYPY3 PYTHON3 RUBY SCALA SCM guile ST TCL WHITESPACE

hide comments
2024-12-03 11:47:12
monh anand odo boovoo sajine
2024-11-27 10:39:16


Last edit: 2024-11-27 10:39:36
2024-08-30 06:22:35
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, a[100], x=1, i;
cin>>n;
for(i=1;i<=n;i++) cin>>a[i];
for(i=1;i<=n;i++){
if(a[i]>a[i-1]) x++;
}
if(x==n) cout<<"YES";
else cout<<"NO";
return 0;
}
//from knight
2024-05-13 05:03:15
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll n;
cin>>n;
vector<ll> temp;
while(n!=0){
ll hehe = n%10;
temp.push_back(hehe);
n/=10;
}
sort(temp.begin(), temp.end());
if(temp[0]==0){
for(int i=1; i<temp.size(); i++){
if(temp[0] != temp[i]){
int lele = temp[0];
temp[0] = temp[i];
temp[i] = lele;
break;
}
}
}
for(ll i=0; i<temp.size(); i++){
cout<<temp[i];
}
return 0;
}

/////////:D
choko in the house
2023-11-28 07:49:33
#include <bits/stdc++.h>
using namespace std;
int main(){
long long n,i=1,k,t,j,m,s,d,q;
long long a[100];
cin>>n;
m=n;
while(m>0){
s=m%10;
if(s==0){
d=d+1;
}
a[i]=s;
m=m/10;
i=i+1;
}
for(j=1;j<=i-1;j++){
for(k=2;k<=i-1;k++){
if(a[k]<a[k-1]){
t=a[k-1];
a[k-1]=a[k];
a[k]=t;
}
}
}
if(d>0){
a[1]=a[d+1];
a[d+1]=0;
}
for(j=1;j<=i-1;j++){
cout<<a[j];
}
return 0;
}

Last edit: 2023-11-28 16:01:24
2023-07-25 15:13:39
#include <cstdio>
int main()
{
long long n;
int a[10] = {0};
scanf("%lld",&n);
while(n>0){
a[n % 10]++;
n /=10;
}
int l = 1;
while(a[l]==0)l++;
printf("%d",l);
a[l]--;
for(int i = 0;i<=9;i++)
{
for(int j = 1 ; j<=a[i] ; j++)
{
printf("%d",i);
}
}
}
2023-07-06 14:37:24
#include <bits/stdc++.h>

using namespace std;

int main ()
{
int cnt[10];
for(int i = 0; i < 10; i++) cnt[i] = 0;
string s;
cin >> s;
long long sz = s.size();

for(int i = 0; i < sz; i++)
{
cnt[s[i] - '0']++;
}

sort(s.begin(), s.end());

cout << s[cnt[0]];

for(int i = 1; i <= cnt[0]; i++) cout << '0';

for(int i = cnt[0] + 1; i < sz; i++)
{
cout << s[i];
}
}
2023-02-14 08:30:58
1


Last edit: 2023-02-14 08:34:04
2022-01-28 09:06:07
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main(){
long long a,b,c1,c2,c3,c4,d,min1=0,n=0,min2=10,k=0;
cin>>a;
c3=a;
c1=a;
c2=a;
while(c1>0){
d=c1%10;
if(d==0){
k++;
}
c1=c1/10;
}
while(c3>0){
d=c3%10;
if(d<min2 & d!=0){
min2=d;
}
c3=c3/10;
}
while(c2>0){
d=c2%10;
n++;
if(d==min2){
break;

}
c2=c2/10;
}
a=a-(min2*pow(10,n-1));
b=min2*(pow(10,k));
c3=a;
while(c3>min1*pow(10,n-1)){
c1=c3-(min1*(pow(10,n-1)));
c2=c1;
c3=c1;
n=0;
min1=10;
while(c1>0){
d=c1%10;
if(d<min1 & d!=0){
min1=d;
}
c1=c1/10;
}
while(c2>0){
d=c2%10;
n++;
if(d==min1){
break;

}
c2=c2/10;
}


b=b*10+min1;


}
cout<<b;
return 0;
}
<3
2021-11-29 07:07:57
#include<bits/stdc++.h>
using namespace std;

int main (){
long long n, result = 0, k = 1, L;
cin>>n;
int a[10] = {0};
while(n > 0){
a[n % 10]++;
n = n / 10;
}
while(k < 10){
if(a[k] == 0){
k++;
}else{
break;
}
}
result = result + k;
a[k] = a[k] - 1;
for(int i = 0;i <= 9; i++){
for(int j = 1;j <= a[i]; j++){
result = result * 10 + i;
}
}
cout<<result;
}
OILGOJ HUULAARAI
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.