QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#236412 | #3530. Small business | Soorraw | WA | 1ms | 3496kb | C++14 | 897b | 2023-11-03 22:27:08 | 2023-11-03 22:27:09 |
Judging History
answer
#define push_back pb
#define first fst
#define second sec
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int N=2e5+10,M=5e2+10,inf=0x3f3f3f3f,mod=1e9+7;//998244353;
const ll inff=0x3f3f3f3f3f3f3f3f;
typedef double db;
const db eps=1e-9;
string s;
void solve()
{
cin>>s;
vector<int>vx;
int cnt=0;
for(auto ch:s)
{
int x=ch-'0';
if(x)
vx.pb(x);
else ++cnt;
}
int sz=s.size();
if(sz==cnt)
{
cout<<((sz==2)?"0 0\n":"-1 -1\n");
return;
}
if(sz<2||sz>36)
{
cout<<"-1 -1\n";
return;
}
sort(vx.begin(),vx.end());
if(cnt)
cout<<"0 ",cnt--;
else cout<<vx[0]<<' ';
cout<<vx[1]<<string(cnt,'0');
for(int i=2;i<sz-cnt;i++)
cout<<vx[i];
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T=1;
// cin>>T;
// T=read();
while(T--)
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3404kb
input:
123456
output:
1 23456
result:
ok ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
42
output:
2 4
result:
ok ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 3456kb
input:
000
output:
-1 -1
result:
ok ok
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3496kb
input:
4418409405
output:
0 404445890
result:
wrong answer '0' used more than necessary