- 博客(15)
- 收藏
- 关注
原创 Python二维列表【重复与循环】
笔者在刷leetcode时,习惯python在算法方面的便捷,故而一般都是用python作答,但是在python的二维列表构造上,出了一些问题,记录如下: 初始化二维数组,我们一般用重复或者循环的法子 list = [] * len But,这样的话,似乎会导致二维数组的每个子列表指向相同地址,通过append()增加某个子列表会导致所有列表改变 但是,如果直接赋值就没有这个问题 当然,使用下面方法,也没有问题 list = [[] for x in range(len)] ..
2021-10-16 23:25:02
1348
1
原创 Codeforces上蓝纪念
今天 某蒟蒻 经过了无数次翻车 codeforces终于也上蓝了 2019年寒假,开始codeforces之旅,虽然一年时间才到了大佬们随手可到的蓝名,但还是很高兴,一年时间,开始的几场场场掉 分,后来勉强到了集训队,大大小小的比赛打了不少,codeforces却几经波折,最接近时1593,可惜异常div 3掉下深渊,起起落 落,终于到了蓝名,继续加油吧!!! ...
2020-02-24 11:01:42
1546
原创 JavaScript操作之name作为变量名
一、问题: 在JS中,定义一个全局数组的时候,如果使用的数组名为 name ,那么定义的数组将自动转化为字符 就像下面的代码,不论你给name赋什么类型的值,最后输出都是 string 二、查资料: 在javascript中name既不是保留字,也不是关键字, 但在window对象中有一个属性是window.name window.name...
2020-01-31 16:26:44
3269
原创 线段树模板
#include <bits/stdc++.h> using namespace std; #define maxn 100007 //元素总个数 #define ls l,m,rt<<1 #define rs m+1,r,rt<<1|1 int Sum[maxn<<2],Add[maxn<<2];//Sum求和,Add为懒惰标记 ...
2019-10-16 17:01:59
155
原创 数学模板整理
/***************** 数学整理 *****************/ #include <bits/stdc++.h> using namespace std; #define ll long long const int maxn=1e6+5; //< 1 > 大数 (Java) /******* import java.util.*; import j...
2019-10-15 13:48:42
494
原创 水篇快速幂
一,快速幂:取幂指数的二进制,从低到高寻找,当前位=1时,加上当前位对应的值,复杂度顺利降到O(logn) //b=1000001101(二进制) //a^b=a^0+a^2+a^3+a^9 //O(log2(b)) typedef long long ll; ll qpow(ll a,ll b) //a^b { ll res=1; while(b>0){ ...
2019-08-12 12:47:00
170
原创 暑假练习记录(四):2017 CCPC Final
一,Dogs and Cages 披着数论外皮的水(nan)题(si),狗狗进笼子,进错笼子的狗狗的期望:n-1,打表许能找出规律来???,,,, #include <bits/stdc++.h> using namespace std; int main(){ int t,n,cas=1; scanf("%d",&t); while(t--){ scanf("...
2019-07-02 21:56:39
264
原创 暑假练习记录(三):2016 CCPC Final
一,The Third Cup is Free 水题,排序,,,, #include <cstdio> #include <algorithm> using namespace std; const int maxn=1e5+5; int a[maxn]; int main(){ int t,cas=1;scanf("%d",&t); while(t--)...
2019-07-01 21:30:02
325
原创 暑假练习记录(二)2014广州赛区
一,Dogs' Candies 暴力,开long long ,莫名其妙的wa,莫名其妙的ac #include <bits/stdc++.h> using namespace std; #define ll long long const int maxn = 2e5+100; const int inf=0x3f3f3f3f; int a1[maxn],b1[maxn]; in...
2019-06-30 21:30:46
199
原创 暑假练习记录(一):2014北京区域赛
一,A Curious Matt 水题一道,排序 #include <cstdio> #include <algorithm> #include <cmath> using namespace std; const int maxn=10005; struct node{ double s,t; }a[maxn]; bool cmp(node a,nod...
2019-06-29 20:42:26
174
原创 并查集——父亲儿子傻傻分不清
算法板子记录第一天:并查集(找爸爸) 并查集,处理不相交集的合并和查询的数据结构,俗称:找爸爸 最先写这个数据结构就是他使用的存储结构最简单,一个数组搞定,当然有别的需要可以另加嘛 int num; //节点数量 int fa[num*2]; //存储节点的上级 int rank[num]; //每个节点的高度 初始化父亲数组 void init(){ for(int...
2019-04-12 18:20:33
321
原创 HDU1097 快速幂取模运算
A hard puzzle Description lcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than...
2018-07-14 20:22:47
311
原创 聪明的鱼儿子,,,,
聪明的鱼儿子 Description 鱼头是一个喜欢创造的人,他发明了一种游戏。给出一个m×n的棋盘。他和他的儿子分别有一个棋子随机的放在棋盘上的两个位置,分别为(x1,y1),(x2,y2).且x1≠x2且y1≠y2.坐标均为整数,且左下角为(0,0)。两个人分别移动自己的棋子(横竖走,步数>=1),但棋子移动不能经过另外一个人所在的行,或列。最后谁无路可走谁就输。鱼头是一个谦让的父...
2018-07-06 21:40:37
423
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅