首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
搜索
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
在线笔面试、雇主品牌宣传
登录
/
注册
西安墨菲特
获赞
2
粉丝
0
关注
1
看过 TA
0
西北工业大学
2020
C++
IP属地:未知
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑西安墨菲特吗?
发布(2)
评论
刷题
收藏
西安墨菲特
关注TA,不错过内容更新
关注
2020-03-19 11:31
西北工业大学 C++
2020-03-19
在牛客打卡2天,今天学习:刷题 3 道
0
点赞
评论
收藏
分享
2019-04-03 11:07
已编辑
西北工业大学 C++
求虎牙今晚前两题的Ac代码
求虎牙今晚前两题的Ac代码
htdwade:
#include <bits/stdc++.h> using namespace std; int main() { int x; vector<int> nums; while(cin >> x){ nums.push_back(x); } auto cmp = [](const int& a, const int& b){ return to_string(a) + to_string(b) < to_string(b) + to_string(a); }; sort(nums.begin(), nums.end(), cmp); string s; for(auto a : nums) s += to_string(a); int index = 0; while(index < s.size() && s[index] == '0') index++; if(index == s.size()) cout << 0 << endl; else cout << s.substr(index) << endl; return 0; } 第二题直接调正则库解决了= = #include <bits/stdc++.h> using namespace std; int main() { string s; while(cin >> s){ regex pattern("[-]?\\d+"); auto numBeg = sregex_iterator(s.begin(), s.end(), pattern); auto numEnd = sregex_iterator(); int res = 0; for(auto i = numBeg; i != numEnd; ++i){ smatch match = *i; string t = match.str(); res += stoi(t); } cout << res << endl; } }
投递虎牙等公司10个岗位 >
0
点赞
评论
收藏
分享
1
创作者周榜
更多
关注他的用户也关注了:
牛客网
牛客企业服务