From 712609a4662606f34280e50964401388c987435f Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Thu, 6 Nov 2025 21:16:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E4=BB=8E=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=B8=AD=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E5=B9=B6=E6=8E=92=E5=BA=8F=E6=95=B0=E5=AD=97=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加头文件并实现从输入字符串中提取数字字符,按降序排序后输出 跳过前导零以避免无效输出 --- src/11/6/P14357.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/11/6/P14357.cpp b/src/11/6/P14357.cpp index 294989d..dae8139 100644 --- a/src/11/6/P14357.cpp +++ b/src/11/6/P14357.cpp @@ -1,3 +1,32 @@ +#include +#include +#include +#include +#include +#include +#include +using ll = int64_t; + +std::string s; +std::vector v; + int main(){ - + std::iostream::sync_with_stdio(false); + std::cin.tie(nullptr); + + std::cin>>s; + v.reserve(s.size()); + for(char c:s){ + if(isdigit(c)){ + v.emplace_back(c); + } + } + std::sort(v.begin(),v.end(),std::greater<>()); + bool isf=true; + for(char c:v){ + if(isf&&c=='0')continue; + isf=false; + std::cout<