Ai
1 Star 0 Fork 0

webturing/cplusplus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
tramsform的使用.cpp 554 Bytes
一键复制 编辑 原始数据 按行查看 历史
计爱玲 提交于 2019-08-19 23:04 +08:00 . 求最小的数字拼接,排序规则是a+b<b+a
//
// Created by jal on 2019-07-25.
//
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
string s="2019-07-25 14:45:23";
transform(s.begin(),s.end(),s.begin(),[](char c)->char{
if(string("0123456789").find(c)==string::npos)
return ' ';
return c;
});
cout<<s<<endl;
int y,m,d,hh,mm,ss;
istringstream iss(s);
iss>>y>>m>>d>>hh>>mm>>ss;
cout<<y<<endl;
cout<<m<<endl;
cout<<d<<endl;
cout<<hh<<endl;
cout<<mm<<endl;
cout<<ss<<endl;
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/webturing/cplusplus.git
git@gitee.com:webturing/cplusplus.git
webturing
cplusplus
cplusplus
master

搜索帮助