2024年9月11日

摘要: 一道比较明显的差分 利用查询递增性质 减少时间复杂度到o{n} include <bits/stdc++.h> using namespace std; const int N=2e5+10; int main() { int dif[N]={0}; int n,m,k,x,j,i,sum = 0, 阅读全文
posted @ 2024-09-11 11:27 lkhshnu 阅读(10) 评论(0) 推荐(0) 编辑

2024年9月9日

摘要: 小模拟 规模确实小 直接模拟不用搞优化 结构体起手模拟窗口 记录编号和优先级 每次点击更新优先级 include <bits/stdc++.h> using namespace std; struct l{ int x1,y1; int x2,y2; int seq; int pri; }; l l 阅读全文
posted @ 2024-09-09 11:03 lkhshnu 阅读(8) 评论(0) 推荐(0) 编辑

2024年9月5日

摘要: include <bits/stdc++.h> using namespace std; int nonzero(int x[],int n,int); int main () { int n,a[500010],i,num=0,j; cin>>n; for(i=1;i<=n;i++) scanf( 阅读全文
posted @ 2024-09-05 11:30 lkhshnu 阅读(5) 评论(0) 推荐(0) 编辑

2024年9月1日

摘要: 数组元素范围小,利用桶排序,遍历桶数组判断是否存在中间数。 include <bits/stdc++.h> using namespace std; int main () { int n,i,sum=0; cin>>n; int a,b[1010]={0}; for(i=0;i<n;i++) { 阅读全文
posted @ 2024-09-01 11:00 lkhshnu 阅读(9) 评论(0) 推荐(0) 编辑

2024年8月27日

摘要: include <bits/stdc++.h> typedef long long ll; using namespace std; int main () { int n,N,a[210],i,sum=0; cin>>n>>N; a[0]=0; for(i=1;i<=n;i++){ cin>>a[ 阅读全文
posted @ 2024-08-27 11:33 lkhshnu 阅读(12) 评论(0) 推荐(0) 编辑
 
摘要: a数组记录距离平方值,其最大为2000的平方,不超int。 b数组记录3个距离最小的坐标。 ans记录下标。 每次选出一个坐标后其距离置为最大值。 include <bits/stdc++.h> typedef long long ll; using namespace std; int main 阅读全文
posted @ 2024-08-27 10:46 lkhshnu 阅读(11) 评论(0) 推荐(0) 编辑

2024年8月18日

摘要: include <bits/stdc++.h> using namespace std; int main () { int n,a[4]={0},i; cin>>n; set st; for(i=1;i<2000;i++){ string z=to_string(i); if(z.find('7' 阅读全文
posted @ 2024-08-18 09:35 lkhshnu 阅读(5) 评论(0) 推荐(0) 编辑

2024年8月4日

摘要: t=0 def setup(): size(600,600) def draw(): global t background(255) translate(width/2,height/2) rotate(radians(t)) for i in range(12): pushMatrix() tr 阅读全文
posted @ 2024-08-04 10:16 lkhshnu 阅读(64) 评论(0) 推荐(0) 编辑

2024年7月25日

摘要: 本题是一道小模拟 规模小 难度在碰撞检测 在写模拟题时的思路应该是先找到应该储存的信息是哪些,抽象出来,应该模拟的方法是哪些。类似oop。 include using namespace std; const int L = 1000; struct ball{ int p; char d=1; / 阅读全文
posted @ 2024-07-25 10:54 lkhshnu 阅读(14) 评论(0) 推荐(0) 编辑

2024年7月19日

摘要: 这道题的话,首先上来读题,发现它是不能采用对每个序号采用累加的方式来判断移动多少的,因为不同序号的移动之间是会相互影响的,就像题例中的三号和八号相互影响了一样,导致三号虽然正二负二,但是并不在原来的位置上。 本题采用的是stl库中的list这个双向链表的数据结构,该数据结构的插入和删除效率高,主要是 阅读全文
posted @ 2024-07-19 16:37 lkhshnu 阅读(16) 评论(0) 推荐(0) 编辑