
本题思路:本题就是根据就是排序的知识点,在sort内部可以使用仿函数来改变此时排序规则。
- #include
-
- const int N=10010;
- int n;
- std::string logs[N];
-
- int main()
- {
- std::ios::sync_with_stdio(false);
- std::cin.tie(nullptr);std::cout.tie(nullptr);
-
- while(std::getline(std::cin,logs[n]))
- if(logs[n].size()) n++;
- else break;
- //内部排序
- sort(logs,logs+n,[&](std::string&a,std::string&b){
- std::stringstream sstreama(a),sstreamb(b);
-
- //将空格分开的字符串读入sa,sb中
- std::string sa[4],sb[4];
- for(int i=0;i<4;i++){
- sstreama>>sa[i];
- sstreamb>>sb[i];
- }
-
- //如果当前消耗时间相等,则需要判断当前开始时间
- if(sa[3]==sb[3]) return sa[1]+sa[2]
1]+sb[2]; -
- double ta,tb;
- std::sscanf(sa[3].c_str(),"%lf(s)",&ta);
- std::sscanf(sb[3].c_str(),"%lf(s)",&tb);
- return ta
- });
-
- for(int i=0;i
- return 0;
- }
二、重复者IO链接
本题思路:对于第q层来说我们需要递归找出第q-1层的图形然后将其存储下来然后和原来图形来更新第q层的图形。
- #include
-
- int n;
- std::vector
p; -
- std::vector
dfs(int k) - {
- if(k==1) return p;
-
- std::vector
last=dfs(k-1);//找出上一版本的字符串 - int m=last.size();
-
- std::vector
res(n*m,std::string(n*m,' ')) ;//当前版本串 -
- for(int i=0;i
- for(int j=0;j
- if(p[i][j]!=' ')
- for(int x=0;x
- for(int y=0;y
- res[i*m+x][j*m+y]=last[x][y];
-
- return res;
- }
-
- int main()
- {
- while(std::cin>>n,n){
- //清空当前的版本串
- p.clear();
- getchar();
-
- for(int i=0;i
- std::string s;
- std::getline(std::cin,s);
- p.push_back(s);
- }
-
- int q;
- std::cin>>q;
- auto res=dfs(q);
- for(auto& str:res)
- std::cout<
- }
- return 0;
- }
-
相关阅读:
Unity Editor 打包指定资源(AssetBundle)和加载指定资源
java毕业设计餐饮类网站Mybatis+系统+数据库+调试部署
[C/C++]_[中级]_[static_cast的详细解析]
STM32CUBEIDE(14)----外部中断EXTI
发行版兴趣小组季度动态:Anolis OS 支持大热 AI 软件栈,引入社区合作安全修复流程
(其他) 剑指 Offer 67. 把字符串转换成整数 ——【Leetcode每日一题】
[游戏开发][虚幻5]新建项目注意事项
Apollo自动驾驶系统概述(文末参与活动赠送百度周边)
详解 Moloch DAO 特性与治理模式
【UVM实战 ===> Episode_3 】~ Assertion、Sequence、Property
-
原文地址:https://blog.csdn.net/qq_67458830/article/details/132757534