文件的三种打开模式

文件的三种打开模式 文件操作的基础模式有三种(默认的操作模式为r模式): r模式为read w模式为write a模式为append 文件读写内容的格式有两种(默认的读写内容的模式为b模式): t模式为text b模式为bytes 需要注意的是:t、b这两种模式均不能单独使用,都需要与r/w/a之一连用。如rt,wb... 一、文件打开模式之r模式 r: read,只读模式,只能读不能写,文件不存在时报错。 f = open('path',mode = 'rt') # path为文件的路径
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[bzoj4553]序列

记第i个位置有三个属性:1.ai表示原来的值;2.bi表示变成最大的值;3.ci表示变成最小的值。那么对于如果i在j的前面,那么必然有:$ai\le cj$且$bi\le aj$,那么令f[i]表示以i为结尾的最长上升子序列,即对求max(f[j])满足j能在i的前面,用树套树维护即可 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define N 100005 4 #define mid (l+r>>1) 5 in
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

Avail HPE6-A14 Exam Cram Curated by HP Experts

Tired of doing the same job? Get your hands on HPE6-A14 exam It is the nature of the human being that he/she will get tired of doing the same task over and over, same is the case of the HPE Aruba Certified professionals. If you are an individual who
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

windwos 子系统 ubuntu18.04安装mysql

https://tecadmin.net/install-mysql-on-ubuntu-18-04-bionic/ sudo mysql -u root mysql> USE mysql; mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> exit; vim /etc/mysql/mysql.conf.d/mysqld.cnf 添加v
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

牛客多校第六场记录

A 题意: 垃圾分类 思路: 模拟 #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <string> #include <stdlib.h> #include <vector> #include <queue> #include <cmath> #include <stack> #include <map> #include <set> #define ll long
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

node.js 在VS Code 添加的插件

1. Terminal : 安装完后, 右键代码, 选择 "Open in integrated Teminal" 方便打开
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[noi34]palindrome

分割实际上就是不断地从两端取出一样的一段,并对剩下的串进行分割。下面我们来证明一下每一次贪心取出最短一段的正确性: 考虑两种分割方式,分别表示成S=A+B+A和S=C+D+C,其中A就是最短的一段,那么当2|A|<|C|,显然就有C=A+E+A,那么就可以用三次划分来完成C,而当|A|<|C|<2|A|,即A在C中重叠了,那么最短的前缀一定不是A,而是重叠部分(重叠部分既是A的前缀又是A的后缀)。 那么这个贪心就成立了,用hash暴力判断即可。 1 #include<bits/stdc++.
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

Improve Score Better With HPE2-N19 Exam Cram

Tired of doing the same job? Get your hands on HPE2-N19 exam It is the nature of the human being that he/she will get tired of doing the same task over and over, same is the case of the HPE Sales Certified professionals. If you are an individual who
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[noi109]排队

题目要求其实相当于要让大于和小于m的数的个数都不超过n/2,因此当要对一个数处理时,要么把它改成m,要么不作修改,根据这个贪心就可以完成了。 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define ll long long 4 ll n,m,k,y,ans,a[200001]; 5 int main(){ 6 scanf("%lld%lld",&n,&m); 7 for(int i=1;i<
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[luogu2303]Longge的问题

1 #include<bits/stdc++.h> 2 using namespace std; 3 #define ll long long 4 ll n,ans; 5 ll phi(ll n){ 6 ll ans=n; 7 for(ll i=2;i*i<=n;i++){ 8 if (n%i==0)ans=ans/i*(i-1); 9 while (n%i==0)n/=i; 10 } 11 i
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

Boost Your Career with HPE2-Z40 Exam Cram Questions

Tired of doing the same job? Get your hands on HPE2-Z40 exam It is the nature of the human being that he/she will get tired of doing the same task over and over, same is the case of the Aruba Certified Switching Associate professionals. If you are a
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

Linux服务之DNS服务篇

一、DNS服务概述 DNS(Domain Name System)域名系统,在TCP/IP 网络中有非常重要的地位,能够提供域名与IP地址的解析服务。 DNS 是一个分布式数据库,命名系统采用层次的逻辑结构,如同一棵倒置的树,这个逻辑的树形结构称为域名空间,由于DNS 划分了域名空间,所以各机构可以使用自己的域名空间创建DNS信息。 注:DNS 域名空间中,树的最大深度不得超过127 层,树中每个节点最长可以存储63 个字符。 模式: C/S 模式 1、域和域名 DNS 树的每个节点代表一个域
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[poj2096]Collecting Bugs

定义状态f[i][j]表示发现了i种bug在j台电脑上后期望多少天能结束,$f[i][j]=(ij\cdot f[i][j]+(n-i+1)j\cdot f[i+1][j]+i(m-j+1)\cdot f[i][j+1]+(n-i+1)(m-j+1)\cdot f[i+1][j+1])/(ns)+1$,解得$f[i][j]=(ns+(n-i+1)j\cdot f[i+1][j]+i(m-j+1)\cdot f[i][j+1]+(n-i+1)(m-j+1)\cdot f[i+1][j+1])/(
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[mine248]

两枚硬币正面向上的概率分别是p和q,抛第一枚硬币每次抛到反面向上走一步,直到抛到正面,重复此步骤改为向右走一步;抛第二枚硬币抛到正面向下走一步,抛到反面向左走一步,求经过起点的概率 设抛完第一枚向上x、向右y,则第一枚的概率是$p^{2}\cdot (1-p)^{x+y}$,第二枚的概率是$c(x+y,x)\cdot q^{x}\cdot (1-q)^{y}$,即总概率是 $p^{2}\sum_{x}\sum_{y}(1-p)^{x+y}\cdot c(x+y,x)\cdot q^{x}\cd
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[mine806]

题意:每一个人手中有一个数,范围是[1,2^n],共有k个人,设存在两个人有相同数的概率的最简分数形式是a/b,分别求a和b模1e6+3,1<=n,k<=1e18 首先概率是$1-\sum_{i=0}^{k-1}(2^{n}-i)/2^{nk}$,显然两者的最大公约数一定是2的幂次,不妨设$1< k<2^{n}$(不在范围内直接输出),那么2的幂次就是$\sum_{i=1}^{60}(m-1)/2^{i}+n$,即分子分母都要除以这个值 考虑到费马小定理:$2^{P-1}\equiv 1(mo
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[mine518]

题意:有一个长度为n的序列,给定某m个位置上的数如ai上有bi,其余的数可以任意,令ci表示ai的前缀异或和,求$\sum_{i=1}^{n}ci$的最小值,1<=m,bi<=n<=1e9,0<=ai<=1e9 空位分两种:1.之后的位置还是空位,这种空位一定可以贪心为0;2.之后的位置已经知道,这时候需要考虑是否要让后面的一段的每一位异或上1,即判断s0+1和s1的大小(si表示某位2进制中该段i的个数),贪心即可(注意第1个位置前没有空位) 1 #include<bits/stdc++.
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[bzoj2844]albus就是要第一个出场

线性基中的所有数一定能够造出所有异或的结果,同时一定只有一种方式(否则这两种方式异或起来为0),那么只需要考虑为了异或出X,每一位的线性基要不要选,若X的这一位是1,那么别的方案一定可以使得这一位是0,因此会增加$2^{剩下的线性基个数}$个比X小的数,否则不会增加 还有重复数字,可以发现除了线性基外的数字任意一种选法都可以与线性基中的数字异或得到某个数字,所以每一个数字重复次数都是$2^{线性基外的数字个数}$,计算一下即可 1 #include<bits/stdc++.h> 2 us
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

Avail HDPCD Exam Cram Curated by Hortonworks Experts

Tired of doing the same job? Get your hands on HDPCD exam It is the nature of the human being that he/she will get tired of doing the same task over and over, same is the case of the HDP Certified Developer professionals. If you are an individual wh
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[luogu4570]元素

根据魔法值从大到小插入到线性基中,然后即输出线性基中的所有数之和 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define ll long long 4 struct ji{ 5 ll id; 6 int k; 7 bool operator < (const ji &a)const{ 8 return k>a.k; 9 } 10 }b[1005];
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0

[bzoj4403]序列统计

插一块板表示让这个数字+1,问题转化为对于长度为1~n的序列,插入r-l块板(首尾也可以插板,每个点板数不限),有多少种方案,即求$\sum_{i=1}^{n}c(r-l+i,r-l)$ 考虑该式,再补上一项c(r-l+1,r-l+1),原式=$\sum_{I=1}^{n}c(r-l+i,r-l)+c(r-l+1,r-l+1)-1=\sum_{I=2}^{n}c(r-l+i,r-l)+c(r-l+2,r-l+1)-1=……=c(r-l+n+1,r-l+1)-1$,用Lucas计算即可 1 #
分类: 其他 发布时间: 08-07 20:08 阅读次数: 0