自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(129)
  • 收藏
  • 关注

原创 区块链之数字签名

区块链中采用对原本信息的哈希值进行加密的方式来进行签名数字签名:签名和验证一个消息M、其哈希摘要D签名者通过自身的私钥Kp生成对应的签名S=F(D,Kp)验证者通过公钥K解密S得到消息M的摘要D=F(S,K)...

2022-02-05 22:58:53 14209

原创 区块链之P2P技术

P2P网络:Intel:通过系统间的直接交换达成计算机资源与信息的共享IBM:由若干互联协作的计算机构成并具备如下特性之一:系统依存于边缘化设备的主动协作;每个成员同时扮演客户端和服务器的角色;系统应用的用户能意识到彼此的存在而构成一个虚拟或真实的群体节点彼此对等,既作为服务和资源的提供者,又作为服务和资源的获取者区块链依靠P2P网络可扩展性、健壮性:P2P网络中的所有对等节点都可以提供带宽、存储空间以及计算能力等资源,随着更多节点的加入,系统整体的资源和服务能力也在同步地得到扩充。负载均衡

2022-02-05 15:32:16 15127

原创 以太坊之Gas

Gas:以太坊中资源消耗的基础单位GasLimit:允许消耗的最大Gas值GasUsed:执行后消耗的最大Gas值GasPrice:用户为消耗的每个Gas单位支付的以太币在交易的执行过程中,每笔交易都带有基础 Gas 消耗值。用户在创建或调用智能合约的过程中,对以太坊虚拟机的不同操作都将消耗不同值的 Gas,基础 Gas 消耗值+以太坊虚拟机运行时的 Gas 消耗值,构成了交易的 GasUsed。交易的 GasUsed 是实时计算的,即以太坊虚拟机的每步操作都将计算累积一次,如果交易的 GasU

2022-02-03 23:38:57 2794

原创 区块链技术概述

区块链:一种分布式数据库技术,通过维护数据库的链式结构,可以维持持续增长的、不可篡改的数据记录。区块链技术的最早应用出现在比特币项目。交易transaction:一次对账本的操作,导致账本状态的一次改变,如添加一条转账记录。区块block:记录一段时间内发生的所有交易和状态结果,是对当前账本状态的一次共识链chain:由区块按照发生顺序串联而成,是整个账本状态变化的日志记录把区块链看成状态机,每次交易视图改变一次状态。每次共识生成的区块,就是参与者对于区块中交易导致状态改变的结果进行确认。链表

2022-01-20 23:46:44 2975

原创 【二分法+进制转换】Radix

二分思想寻找进制long long 溢出的话返回1有些坑点#include<bits/stdc++.h>using namespace std;#define ll long longll targetnum(const string &s,ll radix){ int len=s.length(); ll result=0; ll tm...

2019-02-02 23:12:21 519

原创 POJ1141-Brackets Sequence【DP思想+递归】

题解: dp [ i ] [ j ] 表示添加括号的个数, pos[ i][ j ] 表示 i , j 中哪个位置分开,使得两部分分别匹配。pos [ i ][ j ] 为-1的时候,说明i, j 括号匹配。初始值置dp [ i ] [ i ] = 1; 如果只有一个括号,那么匹配结果必然是差1。首先判断括号是否匹配,如果匹配,那么dp [ i ] [ j ] = dp[ i + 1] ...

2019-01-28 12:47:32 213

原创 UVA 10954 【贪心+优先队列】

贪心思想是:数据排序的贪心方式进行n-1次甲方 每次最小的俩个和进入队列,然后将每次和相加#include<bits/stdc++.h>using namespace std;struct node{ int x; bool operator<(const node &a)const { return x > a....

2019-01-25 01:06:03 201

原创 POJ1315 Don't Get Rooked【DFS】

纯dfs#include <iostream>#include <cstdio>#include <iomanip>#include <string>#include <cstring>#include <cmath>#include <algorithm>#include <queu

2019-01-21 17:46:05 243

原创 POJ1040-Transportation【dfs】

思路设最大收入为best 初始值为0订单数为Countorders[i].from:起始站orders[i].to:目的地站orders[i].passengers订单的人数orders[i].price订单价格orders[i].remaining剩余订单价格(接受剩余订单)约束条件:枚举订单K途径的每个火车站i判断是否超载#include <iostream>...

2019-01-21 16:04:46 262

原创 POJ2083 Fractal【分形回溯】

n度的盒分形的规模为3(n-1),即n度的盒分形图为一个长宽为3(n-1)的正方形。设置递归函数printBox(n,x,y)生成以坐标(x,y)为左上角的n度盒分形。1)递归边界: 若n=1,则在(x,y)输出‘X’2)若n>1,则计算n-1度的盒子的规模 m = 3^(n-2),分别在左上方, 右上方,中间,左下方和右下方画出5个n-1度的盒子。对于左上方的n-1度的盒子,左上角...

2019-01-20 17:11:29 312

原创 POJ2258 The Settlers of Catan【dfs】

道路用a[i][j]表示vis[i][j] :表示用过dfs遍历递归寻找最长的长度#include<iostream>#include<cstdio>#include<cstring>using namespace std;int m,n;int a[30][30];int vis[30][30];int ans;void dfs(int...

2019-01-20 12:05:19 242

原创 POJ 1281 MANAGER【模拟】

思路:设进程最小耗费值minp=1,进程最大耗费值为 输入的maxp.print[k]:进程删除的标志序列cnt[k]:当前耗费k的进程数req:请求类别condition:管理者策略主要在于输入r的处理如果 condition==1 枚举(从minp到maxp) 删除最小(第一个cnt[k]!=0)#include <iostream>#include <cs...

2019-01-19 11:02:53 379

原创 POJ1209 Calendar 【模拟】

题解:读好题意1、设event为结构体事件e.t:发生事件累加一起的时间e.r:事件的重要性e.d:开始事件的日期e.m:开始事件的月份e.id:事件的次序(index)char name:事件名字2、输入year 判断闰年3、A 输入 累加4、D输入 排序 按照题意输出 * ****…(偷看了别人代码很长时间…)#include<iostream>#in...

2019-01-16 21:18:04 331

原创 POJ2255-Tree Recovery【二叉树遍历】

二叉树遍历给出前序和中序,求后序#include <iostream>#include<stdio.h>#include<string.h>using namespace std;char mid[27];char pre[27];int n=-1;void maketree(int i,i

2018-10-21 22:19:40 210

原创 模拟题-蚱蜢

模拟-蚱蜢蚱蜢只能在元音字母(A、E、I、O、U、Y)间跳跃,一次跳跃所需的能力是两个位置的差。纸带所需的能力值为蚱蜢从纸带开头的前一个位置根据规则跳到纸带结尾的后一个位置的过程中能力的最大值。#include<bits/stdc++.h>using namespace std;int main(){ char s[105]; scanf("%s",s); ...

2018-10-12 22:08:32 1477

原创 HRBUST - 1118 火柴棒等式【暴力打表】

HRBUST - 1118 火柴棒等式【暴力打表】调用函数会超时的…只能打表…WA 4 (菜)#include<bits/stdc++.h>using namespace std;int a[1005];int main(){ a[0]=6; a[1]=2; a[2]=5; a[3]=5; a[4]=4; a[5]=5;...

2018-09-28 23:23:29 372

原创 数据结构-KMP【串匹配】

数据结构-KMP对模式串next数组的理解:比如我们已经知道ababab,q=4时,next[4]=2(k=2,表示该字符串的前5个字母组成的子串ababa存在相同的最长前缀和最长后缀的长度是3,所以k=2,next[4]=2。这个结果可以理解成我们自己观察算的,也可以理解成程序自己算的,这不是重点,重点是程序根据目前的结果怎么算next[5]的).,那么对于字符串ababab,我们计算nex...

2018-09-26 22:51:33 341

原创 Codeforces Round #512 (Div. 2,) C. Vasya and Golden Ticket【暴力】

#include<bits/stdc++.h>using namespace std;char s[105];int a[105];int n;int main(){ cin>>n; int sum=0; for(int i=0; i<n; i++) { cin>>s[i]; ...

2018-09-24 13:36:12 357

原创 ACM/ICPC 2018亚洲区预选赛北京赛站网络赛 D【队列】

#1831 : 80 Days时间限制:1000ms单点时限:1000ms内存限制:256MB描述80 Days is an interesting game based on Jules Verne’s science fiction “Around the World in Eighty Days”. In this game, you have to manage the limi...

2018-09-23 20:37:51 331

原创 蓝桥杯+出栈次序:递归+卡特兰数

出栈次序X星球特别讲究秩序,所有道路都是单行线。一个甲壳虫车队,共16辆车,按照编号先后发车,夹在其它车流中,缓缓前行。路边有个死胡同,只能容一辆车通过,是临时的检查站,如图【p1.png】所示。X星球太死板,要求每辆路过的车必须进入检查站,也可能不检查就放行,也可能仔细检查。如果车辆进入检查站和离开的次序可以任意交错。那么,该车队再次上路后,可能的次序有多少种?为了方便起见,假设检查站...

2018-09-22 23:09:10 477

原创 2017 亚洲区(乌鲁木齐赛区)网络赛-H【spfa+邻接表有向图】

spfa模板 邻接表的建立 题意: 给出一个有向无环图,输出一条最长路长度#include<bits/stdc++.h>using namespace std;typedef long long ll;struct node{ int to,val,next;} e[100005];int n,m,x,y,val,cnt;int in[10005],h...

2018-08-23 23:50:12 204

原创 2017 亚洲区(乌鲁木齐赛区)网络赛-E

规律找不出来 百度一波 解释转:序号 半连续数 a b (为了好说明问题,下面所提到的a,b数不包括平方) 1 1 == 1^2*1^2 8 36 == 2^2*3^2 49 1225 == 5^2*7^2 288 41616...

2018-08-22 23:35:45 312

原创 2017 亚洲区(乌鲁木齐赛区)网络赛-C

#include<bits/stdc++.h>using namespace std;int c[1005],d[1005];int main(){ int T; scanf("%d",&T); while(T--) { int n,b; scanf("%d%d",&n,&b); ...

2018-08-22 16:25:44 241

原创 2017 亚洲区(乌鲁木齐赛区)网络赛-A

#include<bits/stdc++.h>using namespace std;int num=-1e9;struct node{ int x,y;} stu[55];int cmp(node a,node b){ if(a.x==b.x) return a.y<b.y; return a.x<b.x;}int main(...

2018-08-21 22:47:09 2294

原创 【学习笔记】中国剩余定理

m相互互质: X被a,b,c处分别余r1,r2,r3。表示为: X%a = r1 x%b = r2 x%c = r3 bc*k1 % a = 1 ac*k3 % b = 1 ab*k3 % c = 1 所以 x = bc * k1 * r1 + ac * k2 * r2 + ab * k3 * r3m不相互互质: 假设我们这里有两个方程: x=a1∗x1+...

2018-08-14 20:02:46 222

原创 HDU-1075-What Are You Talking About【map应用】

Ignatius is so lucky that he met a Martian yesterday. But he didn’t know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatius want ...

2018-08-01 15:49:32 218

转载 学习: ACM-字符串-字典树模板HDU-1251-统计难题

#include <cstdio>#include <cstdlib>#include <cstring>const int MAXN = 26;struct Trie{ // 代表当前节点可以延伸出的边,数量可变 Trie *Next[MAXN]; // 标记当前节点是否是保

2018-08-01 13:54:36 201

原创 树状数组练习:HDU 1556,POJ 1195,POJ 3321,POJ 2352

HDU 1556 Color the ball /一位树状数组板子题(但c[]已经不是定义上的数组了,但是很常用)#include<bits/stdc++.h>using namespace std;const int maxn=100005;int n;int c[maxn];int lowbit(int x){ return x&-x;}...

2018-08-01 00:42:25 164

原创 Codeforces Round #499 (Div. 2) A,B

A题:感觉做麻烦了。。。。#include<bits/stdc++.h>using namespace std;int main(){ int n,k; cin>>n>>k; char s[55]; int a[55]; cin>>s; for(int i=0; i<n; i++) ...

2018-07-27 14:12:20 151

原创 POJ 3264 线段树

RMQ线段树 区间最大值最小值#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn=50050;#define inf 9999999999;struct node{ int l,r; int M

2018-07-26 22:11:37 185

原创 HDU - 3037-Saving Beans[Lucas定理]

Saving BeansProblem Description Although winter is far away, squirrels have to work day and night to save beans. They need plenty of food to get through those long cold days. After some time the sq...

2018-07-25 17:03:41 176

转载 【笔记】求解C(n, m)情况

一、求解C(n, m)公式一: 公式二:公式二可以这么理解,从n个物品中取m个有2种情况:(1)不取第n个物品,于是从前n-1个中取m个; (2)取第n个物品,于是从前n-1个中取m-1; 所以答案是这两种情况的和 二、求解C(n, m)%p,p为大质数当n,m,p都很大的时候,用公式二肯定不行了,费时间又费内存,这时候要用公式一,问题是取模时怎样可以把除法转化...

2018-07-24 23:44:44 863

原创 FZU - 2020 -组合【扩展欧几里得+逆元+Lacus】

给出组合数C(n,m), 表示从n个元素中选出m个元素的方案数。例如C(5,2) = 10, C(4,2) = 6.可是当n,m比较大的时候,C(n,m)很大!于是xiaobo希望你输出 C(n,m) mod p的值! Input 输入数据第一行是一个正整数T,表示数据组数 (T <= 100) 接下来是T组数据,每组数据有3个正整数 n, m, p (1 <= m <= n...

2018-07-24 23:39:24 216

原创 HDU 4715 Difference Between Primes【素数之差,标记】

Difference Between PrimesProblem Description All you know Goldbach conjecture.That is to say, Every even integer greater than 2 can be expressed as the sum of two primes. Today, skywind present a n...

2018-07-23 23:27:56 177

原创 HDU 1215 七夕节

七夕节 Problem Description 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:”你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!” 人们纷纷来到告示前,都想知道谁才是自己的另一半.告示如下:数字N的因子就是所有比N小又能被N整除的所有正整数,如12的因子有1,2,3,4,6. 你想知道你的另一半吗?Input 输入数据的第...

2018-07-23 21:24:01 140

原创 【数论】HDU 1299 Diophantus of Alexandria 【任一分解定理+素数打表】

Diophantus of AlexandriaProblem Description Diophantus of Alexandria was an egypt mathematician living in Alexandria. He was one of the first mathematicians to study equations where variables were ...

2018-07-23 20:48:48 235

原创 补题:牛客网暑期ACM多校训练营(第二场)-A-run

题目大意 白云在健身,每秒可以走1米或跑k米,并且不能连续两秒都在跑。 当它的移动距离在[L,R]之间时,可以选择结束锻炼。 问有多少种方案结束。题目描述 White Cloud is exercising in the playground. White Cloud can walk 1 meters or run k meters per second. Since Whit...

2018-07-21 21:50:57 450 1

原创 UVA 10200 Prime Time【数论-素数区间判断+精度。前缀和】

Euler is a well-known matematician, and, among many other things, he discovered that the formulan2 +n+41 produces a prime for 0 ≤ n < 40. For n = 40, the formula produces 1681, which is 41∗41.Even ...

2018-04-26 22:30:35 262

原创 POJ-2115-C Looooops【模线性方程】

C Looooops Description A Compiler Mystery: We are given a C-language style for loop of type for (variable = A; variable != B; variable += C) statement;I.e., a loop which starts by setting variabl...

2018-04-10 22:29:32 198

原创 HDU-1796-How many integers can you find【dfs+容斥原理】

How many integers can you find Problem Description Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any i...

2018-04-06 17:23:36 213

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除