摘要: 维护两个栈。一个正常放数据,另一个是排序好的数据。 #include <bits/stdc++.h> using namespace std; int main(){ vector<int> data; vector<int> mdata; vector<int>::iterator it; int 阅读全文
posted @ 2024-04-02 20:01 YuKiCheng 阅读(28) 评论(0) 推荐(0)
摘要: 一道很简单的DFS。 #include <bits/stdc++.h> using namespace std; int n,m,a[10010]; vector<int> res; void dfs(int start,int own){ for(int i=start;i<n;i++){ if( 阅读全文
posted @ 2024-04-02 19:24 YuKiCheng 阅读(21) 评论(0) 推荐(0)
摘要: int类型最多表示的21亿,这个题int就可以。 #include <bits/stdc++.h> using namespace std; int getSum(int a){ int res = 0; while(a){ res += a%10; a/=10; } return res; } i 阅读全文
posted @ 2024-04-02 10:18 YuKiCheng 阅读(74) 评论(0) 推荐(0)
摘要: 暴力枚举。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int res1,res2; int main(){ int a,b,c;//女生 男生 寝室数 cin>>a>>b>>c; int min 阅读全文
posted @ 2024-04-02 10:02 YuKiCheng 阅读(96) 评论(0) 推荐(0)
摘要: 这个题目是stl的使用和字符串拼接。 java里头substring是从首部到尾部的位置,但是C++里面substr是首部位置,和要截取的长度。 我算这种经常出错,每次都搞得很晕。 #include <bits/stdc++.h> using namespace std; string cs; in 阅读全文
posted @ 2024-04-02 08:52 YuKiCheng 阅读(118) 评论(0) 推荐(0)