mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
parent
666a989ee6
commit
63eace5d98
98
S2OJ/1625/1625.cpp
Normal file
98
S2OJ/1625/1625.cpp
Normal file
@ -0,0 +1,98 @@
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
std::string s, t;
|
||||
int cnt[10];
|
||||
|
||||
void add(int x, int f = 1) {
|
||||
switch (x) {
|
||||
case 4:
|
||||
cnt[3] += f;
|
||||
cnt[2] += 2 * f;
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
cnt[5] += f;
|
||||
cnt[3] += f;
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
cnt[7] += f;
|
||||
cnt[2] += 3 * f;
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
cnt[7] += f;
|
||||
cnt[3] += 2 * f;
|
||||
cnt[2] += f;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
cnt[x] += f;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> s;
|
||||
|
||||
for (char c : s) {
|
||||
add(c - '0');
|
||||
}
|
||||
|
||||
while (cnt[7] >= 1 && cnt[3] >= 2 && cnt[2] >= 1) {
|
||||
add(9, -1);
|
||||
|
||||
t.push_back('9');
|
||||
}
|
||||
|
||||
while (cnt[7] >= 1 && cnt[2] >= 3) {
|
||||
add(8, -1);
|
||||
t.push_back('8');
|
||||
}
|
||||
|
||||
while (cnt[7]) {
|
||||
add(7, -1);
|
||||
t.push_back('7');
|
||||
}
|
||||
|
||||
while (cnt[5] && cnt[3]) {
|
||||
add(6, -1);
|
||||
t.push_back('6');
|
||||
}
|
||||
|
||||
while (cnt[5]) {
|
||||
add(5, -1);
|
||||
t.push_back('5');
|
||||
}
|
||||
|
||||
while (cnt[3] >= 1 && cnt[2] >= 2) {
|
||||
add(4, -1);
|
||||
t.push_back('4');
|
||||
}
|
||||
|
||||
while (cnt[3]) {
|
||||
add(3, -1);
|
||||
t.push_back('3');
|
||||
}
|
||||
|
||||
while (cnt[2]) {
|
||||
add(2, -1);
|
||||
t.push_back('2');
|
||||
}
|
||||
|
||||
cout << (t.empty() ? "?????" : t) << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1625/data/ex_ggf1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ex_ggf1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ex_ggf1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ex_ggf1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ex_ggf2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ex_ggf2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ex_ggf2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ex_ggf2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ex_ggf3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ex_ggf3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ex_ggf3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ex_ggf3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf5.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf6.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf7.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf8.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf9.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/ggf9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/ggf9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1625/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1625/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user