自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 codeforces暑假集训第二周总结

Moamen and k-subarrays#include<bits/stdc++.h>using namespace std;const int maxn = 1e5 + 10;int t,k,n,x,cnt;int main(){ cin >> t; while(t--){ cnt = 1; cin >> n >> k; vector < pai.

2021-08-10 17:19:53 145

原创 STL运用

vector#include<bits/stdc++.h>using namespace std;const int maxn = 30;vector < vector < int > > v(maxn, vector < int > ());vector < int > pos(maxn,0);void recover(int valx){ int now_stx = pos[valx]; while(v[n.

2021-08-06 22:54:54 89

原创 codeforces2021暑假第一周总结

C - Reorder the Array Codeforces Round #497 (Div. 2)#include<iostream>#include<map>using namespace std;map <int,int> m;int n,maxn,a;void solve(){ for(int i = 0;i < n;i++){ cin >> a; m[a]++; } maxn = -1;.

2021-07-24 18:30:14 148

原创 codeforces第一周总结

1.TMT Document codeforces 715 div2https://codeforces.com/contest/1509/problem/B第二题卡了特别久,完全没有想到如何匹配TMT,呜呜呜我太菜了。这个题的思路是把T分成M前和M后,输入字符串后就将T和M分别弄到两个vector中去,压入的不是字符串,压入的是每个T和M在字符串中的位置。若T和M的数量不是两倍的关系,那就肯定有问题。一共有N个人,那么就有N组TMT,这样我们用贪心的方法,将第1个T 和 第 1 + M个数个T 以及

2021-04-18 14:14:58 155

原创 紫书字符

1.Molar mass#include<cstdio>#include<cstring>using namespace std;const int maxn = 100;int t,num[4];//记录四个元素出现的次数double ans;char s[maxn];int main(){ scanf("%d",&t); while(t--){ memset(num,0,sizeof(num)); scanf("%s",s);//输入字

2021-03-10 21:32:06 75

原创 bfs

1.八迷宫#include<iostream>#include<cstring>#include<algorithm>#include<queue>//bfs需要用队列来做using namespace std;typedef long long ll;//因为体力值太大了需要用ll太存const int maxn = 505;int t,mi[maxn][maxn],n,m;int dy[9] = {-1,-1,-1,0,0,0,1,1,

2021-03-09 19:43:15 65

原创 搜索剪枝

1.Sticks#include<iostream>#include<algorithm>#include<cmath>#include<cstring>using namespace std;const int maxn = 69;int n,sticks[maxn],sum,len,flag;bool used[maxn];bool cmp(int x,int y){ return x > y;}bool dfs(int

2021-03-09 19:17:08 121

原创 dfs

1.Lake Counting最基础的dfs#include<iostream>#define Maxn 105#define Maxm 105using namespace std;char a[Maxn][Maxm];int n,m;void dfs(int y,int x){ a[y][x] = '.';//将走过的地方赋值为. 防止之后再走到这个位置 for(int dy = -1;dy <= 1;dy++){ for(int dx = -1;dx

2021-03-09 18:47:52 60

原创 动态规划之01背包

背包dp是比较经典的dp问题,这里讨论是其中一种情况及其优化1.https://vjudge.net/contest/419435#problem/D#include<iostream>using namespace std;const int maxn = 1005;int dp[maxn][maxn],n,w[maxn],v[maxn],W;//专门开的dp来记录选第几件物品时这个时候的背包容量为多少,这个题用的是正推int main(){ ios::sync_wit

2021-02-18 23:03:05 161

原创 动态规划之记忆化搜索

有的时候有些数据会被重复计算多次,为了避免被重复使用,专门开一个dp数组来记录已经算过的值,一般用memset赋值为-1,若后面遇到这个数组值为-1说明还没有算过,就继续后面的运算1.https://vjudge.net/contest/419435#problem/A(记忆化搜索减少重复计算)#include<iostream>#include<cstring>#define maxn 361using namespace std;int n,dp[maxn][max

2021-02-18 22:43:13 84

原创 三分(整数和浮点数模板)

1.UmBasketella https://vjudge.net/contest/419540#problem/J(浮点数三分)#include<cstdio>#include<algorithm>#include<cmath>using namespace std;const double pi = acos(-1.0);double s;const double eps = 1e-6;double cacl(double x){ dou..

2021-02-12 20:23:38 266

原创 二分(整数和浮点数模板)

1.https://vjudge.net/contest/419540#problem/F(整数二分)#include<iostream>#include<algorithm>#include<cstring>#include<cmath>using namespace std;const int maxn = 1e5 + 10;int mon[maxn],n,m;int check(int x){//这里进行符合条件的判定 int.

2021-02-12 16:29:30 152

原创 STL运用之——nth_element

STL的使用之nth_element1.https://vjudge.net/contest/419420#problem/F#include<bits/stdc++.h>using namespace std;const int maxn = 1e7 + 10;int a[maxn];inline int read(){ char ch = getchar(); int x = 0,f = 1; while(ch < '0' || ch > '9'){

2021-02-11 15:41:30 130

原创 STL运用之set

STL的使用之set1.https://vjudge.net/contest/419420#problem/E(set会维护一个有序集合,自动进行排序并且排除重复元素)#include<set>//主角set#include<sstream>#include<iostream>#include<cstring>#include<algorithm>using namespace std;string s;set < str

2021-02-11 14:53:50 103

原创 STL运用之map

STL运用之map1.https://vjudge.net/contest/419420#problem/C#include<map>#include<cstring>#include<iostream>#include<sstream> //stringstream的头文件using namespace std;string s;map < string , string > maps;//主角map,第一个string是关键字

2021-02-10 21:56:24 106

原创 STL运用之vector

STL的使用之vector1.https://vjudge.net/contest/419420#problem/A#include<iostream>#define maxn 30#include<sstream> // stringstream的头文件#include<cstring>#include<algorithm>#include<vector> //主角vectorusing namespace std;vecto

2021-02-10 20:17:13 90

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除