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

微商网站建设/2023年7月疫情爆发

微商网站建设,2023年7月疫情爆发,软件平台搭建流程,网站后台首页【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 用map < string,vector < int > >mmap[100];来记录每一个数据段某个字符串出现的行数,以及用来判断这个字符串在这一段中存不存在。 ->这里有一个地方要注意,千万不要在未确定这个字符串是否存在…

【链接】 我是链接,点我呀:)
【题意】


在这里输入题意

【题解】


用map < string,vector < int > >mmap[100];来记录每一个数据段某个字符串出现的行数,以及用来判断这个字符串在这一段中存不存在。

->这里有一个地方要注意,千万不要在未确定这个字符串是否存在之前,调用mmap[i][s],因为这样,不管s存不存在,s都会加那么一个键值。
->而这就使得我们不能用更快的mmap[i].find(s)函数来寻找某个字符串在不在了.
->用mmap[i][s]访问,然后判断在不在的方式是会TLE的。

样例有9个'-'但实际上输出10个'-';
然后就是各个数据段之间的分隔符的输出。
or和and的输出都要用set来重新排序。
即从小的行开始到大的行依序输出。

【代码】

#include <bits/stdc++.h>
using namespace std;const int N = 100;int n, m;
vector <string> v[N + 10];
set <int> vv;
map <string, vector<int> > mmap[N + 10];
string s, ts;bool have(int idx, string s)
{if (mmap[idx].find(s)==mmap[idx].end())return false;elsereturn true;
}int main()
{//freopen("F:\\rush.txt", "r", stdin);ios::sync_with_stdio(0), cin.tie(0);cin >> n; cin.get();for (int ii = 1; ii <= n; ii++){int tot = 0;while (getline(cin, s)){if (s == "**********") break;v[ii].push_back(s);int len = s.size();for (int i = 0; i < len; i++)if (isalpha(s[i]))s[i] = tolower(s[i]);elses[i] = ' ';stringstream temp(s);string x;while (temp >> x){mmap[ii][x].push_back(tot);}tot++;}}cin >> m; cin.get();for (int i = 0; i < m; i++){getline(cin, ts);int fi = ts.find(' ', 0);if (fi == -1)//find x{bool ok = false;for (int j = 1; j <= n; j++)if (have(j, ts)){if (ok) cout << "----------" << endl;ok = true;vv.clear();for (int x : mmap[j][ts]) vv.insert(x);for (int x : vv) cout << v[j][x] << endl;}if (!ok) cout << "Sorry, I found nothing." << endl;cout << "==========" << endl;}else{int fi2 = ts.find(' ', fi + 1);if (fi2 == -1)//not x{bool ok = false;ts = ts.substr(fi);while (ts[0] == ' ') ts.erase(0, 1);for (int j = 1; j <= n; j++)if (!have(j, ts)){if (ok) cout << "----------" << endl;ok = true;int lenv = v[j].size();for (int k = 0; k < lenv; k++)cout << v[j][k] << endl;}if (!ok) cout << "Sorry, I found nothing." << endl;cout << "==========" << endl;}else // x y z{stringstream ss(ts);string x, y, z;ss >> x; ss >> y; ss >> z;if (y == "OR"){bool ok = false;for (int j = 1; j <= n; j++)if (have(j, x) || have(j, z)){if (ok) cout << "----------" << endl;ok = true;vv.clear();if (have(j,x))for (int t : mmap[j][x]) vv.insert(t);if (have(j,z))for (int t : mmap[j][z]) vv.insert(t);for (int t : vv) cout << v[j][t] << endl;}if (!ok) cout << "Sorry, I found nothing." << endl;cout << "==========" << endl;}else{bool ok = false;for (int j = 1; j <= n; j++)if (have(j, x) && have(j, z)){if (ok) cout << "----------" << endl;ok = true;vv.clear();for (int t : mmap[j][x]) vv.insert(t);for (int t : mmap[j][z]) vv.insert(t);for (int t : vv) cout << v[j][t] << endl;}if (!ok) cout << "Sorry, I found nothing." << endl;cout << "==========" << endl;}}}}return 0;
}

转载于:https://www.cnblogs.com/AWCXV/p/7682658.html

http://www.lbrq.cn/news/1412173.html

相关文章:

  • 建设京剧网站的意义/百度推广业务员
  • 网站集约化建设讲话稿/中国域名注册官网
  • 株洲企业网站建设费用/站长素材音效
  • 帆布网站做哪个/百度框架户开户渠道代理
  • 江门企业网站建设公司/石家庄最新新闻事件
  • 帮公司做网站赚钱吗/宁波seo推广
  • 黔东南网站建设gzklyy/指数工具
  • 社交网站页面设计/危机公关处理
  • 品牌网站建设四川/企业宣传片视频
  • 小程序转换成网页/海阳seo排名优化培训
  • 网站的网络公司/广告推广软文案例
  • 网彩预测网站制作教程/在线营销推广
  • 个人php网站/免费发布活动的平台
  • 做配色的网站/天天外链官网
  • 网站开发2008/宜昌seo
  • 做更好的自己 网站/打字赚钱平台 学生一单一结
  • 沈阳网站建设技术公司排名/百度怎么推广
  • javascript做网站重要吗/网络营销的整体概念
  • 免费b2c的网站有哪些/抖音seo关键词优化
  • 阿里云iot网站开发/域名注册查询网站
  • 江门百度网站快速优化/外链链接平台
  • 做电子政务 网站/灰色词快速排名接单
  • 开发论坛网站/厦门网络推广培训
  • 做一家网站需要多少钱/在线crm
  • 电信网络服务商/山西优化公司
  • 购物网站开发 webstorm/国外免费建站网站搭建
  • 网站全景图怎么做/百度指数上多少就算热词
  • 做网站设计需要哪些知识/网络营销考试答案
  • 开设计公司客源哪里找/安卓系统优化软件
  • 成都网站公司/域名购买
  • Linux网络服务(一)——计算机网络参考模型与子网划分
  • Java 基础 -- Java 基础知识
  • implement libwhich for Windows
  • 【Html网页模板】赛博朋克数据分析大屏网页
  • 【图论】分层图 / 拆点
  • 每日任务day0816:小小勇者成长记之符文羊皮卷