- 博客(7)
- 收藏
- 关注
原创 PIPIOJ 1330 PIPI的乐高积木 (STL:set)
新的联合容器,set。 一.set(集合) 元素默认从小到大排序。 遍历需要迭代器,效率较序列容器低。 其实现为树,不能用[]访问。 所有内容不可修改。 二.set常用操作 s.begin() s.end() s.clear() s.empty() s.insert()//插入一个元素 s.erase()//删除一个元素,参数既可以是迭代器也可以是值 s.size() s.find()//查...
2020-02-19 16:11:56 223
原创 PIPIOJ 1173 PIPI的集合 (STL/中途相遇法)
由于第二遍做,思路还是有的。 //第一次提交 #include<bits/stdc++.h> #include<unordered_map> using namespace std; const int N = 1e5+7; vector<vector<int> >vec(4);//不定义外层大小出错 unordered_map<int, in...
2020-02-18 10:14:43 184
原创 PIPIOJ 1114 十六进制转换 (STL)
16进制转8进制,以二进制为桥梁,用两个map转换一下即可,然而我没想到,菜。 涉及一些我不会的string用法。 #include<bits/stdc++.h> #include<unordered_map> using namespace std; const int N = 1e5+7; string s; unordered_map<char, string ...
2020-02-17 16:41:07 294
原创 PIPIOJ 1037 排名 (结构体入门)
因为这道题在STL的课里,虽然第二遍做但是还是顺着前几道题的思维用map做了,用STL做太麻烦,暂未发现STL的简单方法。 样例过了但答案错50%,不想深究了。 //答案错误50% #include<bits/stdc++.h> using namespace std; const int N = 1e3 + 7; int score[13];//M道题的分值 string s[N];...
2020-02-17 16:38:11 196
原创 PIPIOJ 1065 统计气球 (STL)
由于是简单题,第二遍做思路比较顺,中间卡了一下,提交时卡第二下。 //原错误答案 const int N = 1e3 + 7; string s[N];//最开始写成string[N],滑稽 map<string, int >mp; int main(){ int n; while (scanf_s("%d", &n) != EOF) { for (int i = 0;...
2020-02-16 15:45:31 219
原创 PIPIOJ 1334 PIPI计数 (STL入门)
map入门题,简单。 #include<bits/stdc++.h> using namespace std; const int N = 1e5 + 7; struct Node { int x, y; bool operator<(const Node& other) const {//重载运算符 return x < other.x || x == o...
2020-02-14 20:28:29 305
原创 PIPIOJ 1325 社交网络 (STL/bfs)(留意queue)
#include<bits/stdc++.h> using namespace std; const int N = 1e3 + 7; vector<int >vec[N];//邻接表思想,同二维数组,可用嵌套模板声明vector<vector<int>>a(未尝试) int s[N]; bool viss[N], vis[N]; int ans[N...
2020-02-14 14:50:36 267
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人