栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

unordered

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

unordered

矩阵赋值问题

#include
#include
using namespace std;
int tr[10005], tc[10005]; //tr[i]=10记第i行最后一次修改值为10,tc记列。
typedef pair PII;
unordered_maphang;
unordered_maplie;
int n, m,q;
int main()
{
int t,x,y;
cin >> n >> m >> q;
for (int i = 0; i < q; i++)
{
cin >> t >> x >> y;
if (t == 1) {
hang[x] = { t, y };
}
else {
lie[x] = { t, y };
}
}
for (int i = 1; i < n; i++){
for (int j = 1; j < m; j++){
if (hang.count(i) && lie.count(j)) {
int ht = hang[i].first;
int lt = lie[j].first;
if (ht > lt)
{
cout << hang[i].second << " ";
}
else
{
cout << lie[j].second << " ";
}
}
else if (hang.count(i)) cout << hang[i].second << " ";
else cout << lie[j].second << " ";
}
cout << endl;
}
}

C++ 万能头文件 #include (写了这个一个下面的都可以不用写啦,一劳永逸有木有)

数据流输入/输出:cin>>,cout<<的头文件:#include

算法类函数:sort()…的头文件 #include

各个数学函数:max(),min(),sqrt()…的头文件 #include 或 #include

字符串操作的头文件 #include 或 #include

结构类:链表,图,队列,迭代器,栈的头文件:

#include #include #include #include #include

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/303236.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号