【字符串】——hash
直到今天,我才知道哈希是这样写的。 对于一个字符串c,我们可以将它hash掉,得到一个与众不同的值。 定义 typedef unsigned long long ull;
const int N=4e5+10;
char c[N];
ull h[N],g[N];
void hash(){
g[0]=1;
for(int i=1;c[i];i++){
h[i]=h[i-1]*131+c[i];
g[i]=g[i-1]*131;
最新Ubuntu18.04安装Pycharm并建立快捷方式
一、安装Pycharm 这个过程很简单,和Windows差不多。 进入官网下载对应的Linux版本 接下来就是进入安装包下的bin目录 输入命令 sh ./pycharm.sh 接下来就是一步一步的安装了。 二、为Pycharm创建快捷方式 1. 创建 pycharm.desktop 文件 首先切换目录到桌面: cd ~/桌面 用 vim 创建 pycharm.desktop : vim pycharm.desktop 内容如下(注意一定要写绝对路径): [Desktop Entry]
Na
CSS3做出条纹大背景
㈠实现不等宽背景条纹 实现如上图所示的效果,代码如下: 1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <style type="text/css">
6 .cont{
7
8 width: 500px;
9
10 height: 200px;
poj 1293 Duty Free Shop
Duty Free Shop Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 1896 Accepted: 730 Special Judge Description Pedro travelled to Europe to take part in the International Olympiad in Informatics and is coming back home. Since all his friends
排序算法之——插入排序
插入排序思想:将插入的元素记录,与前面的元素进行比较大小,查询到插入的位置,然后再将比它大的元素向后面移动,空出插入的位置,将元素插入。 剩下的和②步骤一样。。。 代码这里给出了3种,从基础到优化 //1
void InsertSort(int* a, int n)
{
for (int i = 1; i < n; ++i)
{
if (a[i] < a[i - 1])
{
int temp = a[i];
22-链表中倒数第k个节点
题目:输入一个链表,输出该链表中倒数第k个节点。 def find_Kth_tail(head,k):
if not head or k<1:
return None
p = head
q = head
cnt = 0
while p:
cnt+=1
p=p.next
if k>cnt:
return None
p = head
f
关于正则表达式进行自定义校验
包含几种规则: 1.格式“BIL1100”,规则:前三位是字母,后四位是数字。 var validateNumber = (rule, value, callback) => {
const age= /^[A-Za-z]{3}[0-9]{4}$/;
if (!age.test(value)) {
callback(new Error('格式不正确,例:“BIL1100”'));
}else{
c
Django的orm配置
一.路由系统 a. 创建app
- pycharm 创建
- 使用命令行的方式创建时候,
python manage.py startapp app02
上述两种方式的区别:
使用pycharm创建, 会自动帮我们注册app
而使用命令行的方式, 并不会帮我们注册
b. 路由的分组
urls.py:
Resit Assignment – CSC3060 “AIDA”
Resit Assignment – CSC3060 “AIDA” Release date: Friday 5th August Deadline: 11:00pm Sunday 11 th August 2019. This version: 2019-07-04. Introduction This assignment re-assesses key practical and theoretical learning outcomes from the CSC3060 module.
Assignment 1 — Secure Programming
Assignment 1 — Secure Programming 2019 Part 1 — 4% Question 1 — 1% It’s 4pm on Friday. Your assignment is due in 7 hours and 59 minutes. A friend invites you to a pub. You reason that one beer would help you focus, submit a partial solution and go.
今日推荐
周排行