1 条题解
-
0
#include <bits/stdc++.h> #define int long long // 仅在需要大整数时使用,memset 数组为 0x3f 时去掉 #define INF 0x3f3f3f3f #define PII pair<int, int> #define ULL unsigned long long #define PIII tuple<int, int, int> #define all(v) v.begin(), v.end() #define debug(a) cout << #a << " = " << a << endl; using namespace std; constexpr int N = 1 * 1e6 + 10, M = 5 * 1e3 + 10; void solve() { string num; cin >> num; int zero = count(all(num), '0'); sort(all(num)); bool f = false; for (auto c : num) { if (c == '0') continue; else if (!f){ cout << c; for (int i = 0; i < zero; i ++) cout << "0"; f = true; } else { cout << c; } } } signed main() { ios::sync_with_stdio(0); cin.tie(nullptr), cout.tie(nullptr); int _ = 1; // cin >> _; while (_--) { solve(); } return 0; } /** * author: Nijika_jia * description: C++17 Algorithm Template for Competitive Programming */
- 1
信息
- ID
- 5623
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 9
- 标签
- 递交数
- 164
- 已通过
- 17
- 上传者