- 博客(209)
- 收藏
- 关注
原创 学生免费用IDEA
第一步:官网免费申请进去之后点击立即申请。来到这个界面:这时候有些博主就瞎写了,搞的我弄半天电子邮件。其实在校大学生应该点击官方文件按照要求填写就行了,自己的邮箱,学信网的证明,学校名称等等。最后点击申请免费产品就搞定了,工作日是一个星期就有邮箱回复的,我是等了一天就回了,还挺快的。...
2022-05-14 21:50:32
1004
6
原创 数据库(1)基础知识
mysql的登录登出 :方法一:通过MySQL再带的客户端(只限于root用户)方法二:通过windows自带的客户端登录:MySQL【-h主机名 -p端口号】-u用户名 -p密码退出:exit或者ctrl+cmysql的常见命令:1.查看当前所有的数据库 show databases;2.打开指定的库 use 库名3.查看当前库的所有表 show tables;4.查看其他库的所有表 show tables from5.创建一个表 create table 表名{ 列名 列类型; }
2022-05-12 02:03:28
278
原创 Codeforces Round #789 (Div. 2)(A-D)
Codeforces Round #789 (Div. 2)A. Tokitsukaze and All Zero Sequence一个小小的思维贪心,很容易知道如果有0,直接用0去和其他数处理,如果没有就先创造一个#include <bits/stdc++.h>using namespace std;#define int long longconst int M = 1e9 + 7;const int N = 2e6 + 9;int a[N];signed main(){
2022-05-09 22:09:58
223
原创 Codeforces Round #781 (Div. 2)(A-D)
A. GCD vs LCM#include<bits/stdc++.h>using namespace std;#define int long longsigned main(){ int t; cin>>t; while (t--) { int n; cin>>n; cout<<n-3<<" "<<1<<" "<<1<<" "<<1<<endl
2022-04-09 16:15:12
362
原创 1622C. Set or Decrease
C. Set or Decrease一道思维题#include <bits/stdc++.h>using namespace std;#define int long longconst int N = 2e5+7;int a[N];signed main(){ int t; cin>>t; while (t--) { int n,k,sum = 0; cin>>n>>k; for (int i=0;i<n;i++)
2022-03-25 15:05:30
316
原创 1634D. Finding Zero
D. Finding Zero构造,我们设a,b,c里面有最大值和最小值在这里插入代码片,然后再从中找到二者#include<bits/stdc++.h>using namespace std;const int N = 2e6+7;int ask(int a,int b,int x){ cout<<"? "<<a<<" "<<b<<" "<<x<<endl; cin>>x; ret
2022-03-22 13:56:45
187
原创 1634C. OKEA
C. OKEA一道简单的数学问题,一行只能有奇数或者偶数,进行判断就行了#include<bits/stdc++.h>using namespace std;const int N=1e6;int main(){ int t,n,k; cin>>t; while (t--&&cin>>n>>k) { int cnt = (n*k+1)/2;//奇数的数量 if (cnt%k==0) { cout<&
2022-03-19 21:24:02
244
原创 1641B. Repetitions Decoding
B. Repetitions Decoding一个写起来繁琐一点的构造,主要是要记录到哪了。#include<bits/stdc++.h>using namespace std;const int N=1e6;int t,n,a[N],p[N],v,l,r,A[N],B[N],c,q[N],s;void T(int x,int y){ A[++c]=x,B[c]=y;//A存储地方,B存储数值 for(int i=n;i>x;i--) a[i+2]=a[i]; a
2022-03-19 20:22:25
1126
原创 1612D. X-Magic Pair
D. X-Magic Pair一道数学题,我们让a>=b,那么如果x在a到a%b之间就可以通过a-n*b得到然后辗转相余#include <bits/stdc++.h>using namespace std;#define int long longconst int mod = 998244353;const int N = 2e5 + 9;map<int, int> mp;signed main(){ int t; cin >&g
2022-03-18 22:09:21
330
原创 1644E. Expand the Path
E. Expand the Path一道灯下黑的题目。我们很显然知道,要让每个列的上限最小,下限最大(同理计算行也可以)。所以图形应该是一个中心对称图形所以空白部分是一个矩形(除了一开始的地方),但是还要加上一开始的部分。#include <bits/stdc++.h>using namespace std;#define int long longstring str;signed main(){ int t; cin>>t; whil
2022-03-18 16:21:17
389
原创 1506G. Maximize the Remaining String
G. Maximize the Remaining String贪心,放置时,如果前面一个小比他小,并且后面还有,那么就把前面的删除#include <bits/stdc++.h>using namespace std;const int N = 3e5 + 3;#define int long longstring str;char ans[N];map<char,int>mp,vis;signed main(){ int t; cin>
2022-03-17 21:53:48
276
原创 1560F1. Nearest Beautiful Number (easy version)
F1. Nearest Beautiful Number (easy version)预处理加二分#include <bits/stdc++.h>using namespace std;const int N = 3e5 + 3;#define int long longset<int>cun1,cun2;signed main(){ //单个 for (int i=1;i<=9;i++) { int res = 0;
2022-03-17 17:46:16
347
原创 1388C. Uncle Bogdan and Country Happiness
C. Uncle Bogdan and Country Happiness纯纯DFS#include <bits/stdc++.h>using namespace std;const int N = 1e5 + 3;#define int long longint a[N], b[N], c[N];vector<int> cun[N];int vis[N];int ff = 1;void DFS(int x){ int res = 0; int
2022-03-17 00:47:51
220
原创 1476D. Journey
D. Journey一道简单线性dp#include <bits/stdc++.h>using namespace std;const int N = 5e5 + 3;char str[N];int a[N],b[N];int main(){ int t; cin>>t; while (t--) { int n; cin>>n; cin>>str+1;
2022-03-16 14:00:38
187
原创 1359C. Mixing Water
C. Mixing Water一个简单的思维。因为是一隔一的,所以要么热水多放一个,要么冷水和热水一样多。设热水与要求的差为cou1,冷水与要求的差为cou2。所以我们先考虑两种情况:1,cou1大于cou2,那么肯定是要么只放两个,或者一个热水正好。2,cou2大于cou1,那么每次加两个就是减小热水和要求的差值,那么减到多少合适呢? 这时就要判断一下了,这里也是容易错的地方。 因为判断是平均值的差,所以记得转换成double型求平均值。#include <bits/st
2022-03-15 15:17:46
461
原创 D. Flowers
D. Flowers一个简单线性dp#include <bits/stdc++.h>using namespace std;#define int long longconst int mod = 1e9 + 7;int a[(int)2e6];signed main(){ int t, k; cin >> t >> k; a[0] = 1; for (int i = 1; i <= 1e5 + 5; i++)
2022-03-15 13:34:54
158
原创 2022牛客寒假算法基础集训营1(蒻蒻补题)
A#include <bits/stdc++.h>using namespace std;#define int long longconst int mod = 998244353;vector<int> a((int)2e6);signed main(){ int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i];
2022-03-09 23:20:45
116
原创 P3379 【模板】最近公共祖先(LCA)
倍增查祖先[题目]:(https://www.luogu.com.cn/problem/P3379)#include <bits/stdc++.h>using namespace std;#define int long longvector<int> ve[(int)5e5+7];int lg[(int)5e5+7];int fa[(int)5e5+7][30], depth[(int)5e5+7];int vis[(int)5e5+7];int n, m, s,
2022-03-09 16:20:49
95
原创 B. File List
174B. File List:题目可恶啊,写了一堆bug,最讨厌字符串处理了(〃>目<)#include <bits/stdc++.h>using namespace std;// #define int long longstring s, ss = "";vector<string> ve;signed main(){ // freopen("input.txt","r",stdin); // freopen("output.txt","w",
2022-03-03 04:03:02
85
原创 E. Anfisa the Monkey
44E. Anfisa the Monkey老题目,不更新,不值1400分,建议减分#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c[(int)6e5];const int mod = 1e9 + 7;string s;signed main(){ int n,a
2022-03-03 02:21:43
120
原创 180C. Letter
C. Letter:题目#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c[(int)6e5];const int mod = 1e9 + 7;string s;signed main(){ cin>>s; int n = s.length();
2022-03-03 02:13:25
89
原创 359B. Permutation
B. Permutation:题目很容易就发现,按顺序正好等于0。把i和i+2换一次可以加2,所以k是多少就换几次#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c[(int)6e5];const int mod = 1e9 + 7;signed main(){ in
2022-03-03 02:08:12
119
原创 548B. Mike and Fun
B. Mike and Fun:题目太离谱了呀,这啥遍历题啊。。。#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c[(int)6e5];const int mod = 1e9 + 7;int g[1001][1001];signed main(){ int n,m
2022-03-03 01:51:46
78
原创 940B. Our Tanya is Crying Out Loud
B. Our Tanya is Crying Out Loud;题目1特判,因为除1还是本身,这点就很淦#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c[(int)6e5];const int mod = 1e9 + 7;signed main(){ int n,
2022-03-03 01:20:50
107
原创 253B. Physics Practical
B. Physics Practical:题目太简单的题目了,和dp没啥关系#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c[(int)6e5];const int mod = 1e9 + 7;signed main(){ freopen("input.txt","r",
2022-03-03 00:58:30
133
原创 1415C. Bouncing Ball
C. Bouncing Ball:题目很好的dp,1400分难见的题#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c[(int)6e5];const int mod = 1e9 + 7;string s;signed main(){ int t; cin
2022-03-03 00:05:44
107
原创 602B. Approximating a Constant Range
B. Approximating a Constant Range:题目可恶啊,不知道为什么我双指针的代码不过,重新写了个。。。。。#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c[(int)6e5];const int mod = 1e9 + 7;string s;mul
2022-03-03 00:05:43
80
原创 797B. Odd sum
B. Odd sum:题目一道小小的贪心#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c[(int)6e5];const int mod = 1e9 + 7;string s;multiset<int> se;signed main(){ int n
2022-03-03 00:05:38
85
原创 1189C. Candies
C. Candies:题目思维题,我是笨蛋。我看了半天也没想明白怎么dp,可恶啊。#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c((int)6e5);const int mod = 1e9 + 7;signed main(){ int n; cin>
2022-03-02 18:13:31
204
原创 505B. Mr. Kitayuta‘s Colorful Graph
B. Mr. Kitayuta’s Colorful Graph:题目一开始就像到了DFS,并查集也不难想到。弗洛伊德算法倒是不容易想到,平时不这么用。。。。。#include <bits/stdc++.h>using namespace std;#define int long long// vector<int> a((int)6e5);// vector<int> b((int)6e5), c((int)6e5);const int mod = 1
2022-03-02 17:06:54
83
原创 1284B. New Year and Ascent Sequence
B. New Year and Ascent Sequence:题目小小思维题#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c((int)6e5);const int mod = 1e9 + 7;signed main(){ int t; cin>&g
2022-03-02 16:34:32
88
原创 1282B1. K for the Price of One (Easy Version)
B1. K for the Price of One (Easy Version):题目两种情况,前面取一或者前面不取#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c((int)6e5);const int mod = 1e9 + 7;string s;signed mai
2022-03-02 01:48:02
80
原创 1215B. The Number of Products
B. The Number of Products:题目#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);signed main(){ int n; cin>>n; for (int i=1;i<=n;i++) cin>>a[i]; vector<int>dp(3);
2022-03-02 01:32:06
137
原创 1276A. As Simple as One and Two
A. As Simple as One and Two:题目思路:删去中间#include <bits/stdc++.h>using namespace std;#define int long longvector<int> a((int)6e5);vector<int> b((int)6e5), c((int)6e5);const int mod = 1e9 + 7;string s;signed main(){ int t; c
2022-03-02 01:20:19
118
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人