当前位置: 首页 > news >正文

电商品牌网站开发运营seo网站排名的软件

电商品牌网站开发运营,seo网站排名的软件,杭州网站建设找思创,多少钱一个网站CSTL之Map容器 - 数据结构教程 - C语言网 (dotcpp.com)https://www.dotcpp.com/course/118CSTL之Pair类模板 - 数据结构教程 - C语言网 (dotcpp.com)https://www.dotcpp.com/course/119 刷到一个扫雷的题目,之前没有玩怎么过扫雷,于是我就去玩了玩…

C++STL之Map容器 - 数据结构教程 - C语言网 (dotcpp.com)icon-default.png?t=N7T8https://www.dotcpp.com/course/118C++STL之Pair类模板 - 数据结构教程 - C语言网 (dotcpp.com)icon-default.png?t=N7T8https://www.dotcpp.com/course/119        刷到一个扫雷的题目,之前没有玩怎么过扫雷,于是我就去玩了玩,一玩就凌晨两点,直接上瘾好几天哈哈。

        言归正传,瞅瞅这道编程题,不难,用pair表示坐标,map<pair<int,int>,int>关联容器存储各坐标点状态(key-2维坐标,value-地雷状态0/1),然后迭代器遍历map地雷阵,计算当前坐标点处四周8个位置的地雷数(注意地雷矩阵边缘处的邻近区域的特殊性,可以通过map的find()成员函数的返回值鉴定),输出。

 

#include<iostream>
#include<map>
#include<vector>
using namespace std;void mineSweeper(const map<pair<int,int>,int>& sweeper, vector<int>& sweeper_size){for(auto it=sweeper.begin(); it!=sweeper.end(); it++){// sweeperif(it->second == 1){cout<<"*";}// not sweeper, count sweeper_num aroundelse{int sweeper_sum=0;for(int i=-1; i<=1; i++){for(int j=-1; j<=1; j++){int locs_1 = it->first.first + i;int locs_2 = it->first.second + j;if(sweeper.find(make_pair(locs_1,locs_2)) != sweeper.end()){// cout<<"("<<locs_1<<","<<locs_2<<")";sweeper_sum += sweeper.find(make_pair(locs_1,locs_2))->second;// cout<<"<"<<sweeper_sum<<">";}}}cout<<sweeper_sum;}if(it->first.second == sweeper_size[1]){cout<<endl;}}
}int main()
{int num = 0;while(1){++num;// inputpair<int,int> locs;char input;map<pair<int,int>,int> sweeper;vector<int> sweeper_size(2);// sweeper size  inputcin>>sweeper_size[0]>>sweeper_size[1];if(sweeper_size[0]==0 && sweeper_size[1]==0){break;}// sweeper content inputfor(int i=1; i<=sweeper_size[0]; i++){for(int j=1; j<=sweeper_size[1]; j++){cin>>input;locs=make_pair(i,j);if(input == '*'){sweeper.insert(pair<pair<int,int>,int>(locs,1));}else{sweeper.insert(pair<pair<int,int>,int>(locs,0));}}}// // debug input// for(auto it=sweeper.begin(); it!=sweeper.end(); it++){//     // cout<<it->first.first<<","<<it->first.second<<":"<<it->second<<endl;//     cout<<it->second;//     if(it->first.second == 4){//         cout<<endl;//     }// }  // mineSweepercout<<"Field #"<<num<<":"<<endl;mineSweeper(sweeper, sweeper_size);cout<<endl;}return 0;
}

http://www.tj-hxxt.cn/news/17286.html

相关文章:

  • 园林景观设计公司发展规划成都seo公司
  • 重庆市建设工程施工安全网重庆seo教程搜索引擎优化
  • 诸城网站建设哪家好宁波seo关键词
  • 哪些网站做的最好怎么联系百度推广
  • 潍坊响应式网站建设关键词优化一般收费价格
  • 做网站公司在哪seo收录查询
  • 临沂做拼多多网站网络销售平台有哪些
  • 馆陶网站建设价格怎么推广游戏代理赚钱
  • 网站一键制作网络推广app
  • 齐齐哈尔网站开发整站优化加盟
  • 做化妆品代理在那些网站比较多如何制作付费视频网站
  • 无锡网站备案阜新网站seo
  • 页游在线玩乌鲁木齐seo
  • 广东阳江政府网seo教学视频教程
  • 重庆网站建设公司有哪些网络营销的策略有哪些
  • 服务器有了网站怎么做的天津百度快速排名优化
  • 广西网站建设定制windows优化大师的优点
  • 网站建设和网络推广百度会员登录入口
  • wordpress建立企业网站seo搜索引擎优化论文
  • 莆田网站建设开发seo排名助手
  • 亳州做网站长沙seo霜天博客
  • 网站建设公司内幕2022百度收录越来越难了
  • 网站建设合同】江西seo推广软件
  • 广西城乡建设厅网站首360seo排名点击软件
  • 建设网站的网站2022年最近十大新闻
  • 帮人做钓鱼网站以及维护台州网站建设平台
  • 什么网站是用html做的沈阳网站推广优化
  • 手机上做网站php山东自助seo建站
  • 移动网站开发试验报告南宁seo渠道哪家好
  • 做专门的表白网站外贸独立站推广