自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Unyielding will

一只小菜鸟~

  • 博客(25)
  • 资源 (1)
  • 收藏
  • 关注

原创 NYOJ 33蛇形填数

题目链接主要是模拟, 需要注意的 是类似插入排序  先试探 下一个位置 是否可以放入数 如果不可以就转向 下、左、上、右#include#define MAX 105#includeint a[MAX][MAX];int main() { int n; scanf("%d",&n); int t = 0; memset(a,0,sizeof(a))

2017-12-22 18:27:34 193

原创 计算几何初步

#include#include#define EPS 1e-6using namespace std;typedef struct Point{ int x, y; Point(int xx, int yy):x(xx), y(yy){}}point;bool isZero(double x){ return (x = -EPS);}//叉积判断 OB相对 OA方向 如果

2017-12-19 09:36:05 243

原创 同余定理 + 快速幂

同余定理:(a*b)%c == ((a%c)*b)%c == ((a%c * b%c)%c 证明(前一种): (a*b - a%c*b )为c的 倍数即可 提取b得到 b(a-a%c) 易知其为 c的  倍数 ,得证          一、一般的幂次取余 (主要利用(a*b)%c == ((a%c)*b)%c) ll normal_mod(ll a, ll b, ll c){...

2017-12-18 19:18:27 661

原创 hdoj 2544 最短路径 dijkstra + 优先队列

点击打开链接这题 注意点 :    用vector模拟 邻接表每个Case需要 清空vector (切记)   可以只用一个Edge对象 同时表示 优先队列的(顶点,距离)对象 又表示边集合  优先队列 比较的两种写法 一种写成friend形式(不能加const) 一种末尾必须加const0ms AC#include#include#include#defin

2017-12-17 16:00:41 262

原创 hdoj 1874 单源最短路径

这里 需要注意 输入边的时候 可能重复输入 I - > j的边 需要判断 map[I][j] > w 选择 多次输入中最小的边dijkstra#include#include#define MAX 300#define INF 999999999using namespace std;int map[MAX][MAX];int dis[MAX];bool vis[MAX];

2017-12-16 20:40:21 189

原创 二叉堆 删除 插入 调整 堆排序

以最大堆为例#include#define MAX 10000using namespace std;typedef struct Heap Heap;struct Heap{ int size; int data[MAX];};//堆调整 void adjust_heap(Heap *heap, int size, int i){ int parent, child;

2017-12-16 13:30:56 333

原创 康拓展开

康托展开其中,{\displaystyle a_{i}}为整数,并且{\displaystyle 0\leq a_{i}。{\displaystyle a_{i}}的意义参见举例中的解释部分举例例如,3 5 7 4 1 2 9 6 8 展开为 98884。因为X=2*8!+3*7!+4*6!+2*5!+0*4!+0*3!+2*2!+0*1!+0*0!=98884.解

2017-12-12 22:39:38 452

原创 hdoj 1001 水题坑人 小心

题目链接可能在n*(n+1)乘法的时候,会溢出。看这句要求“You may assume the result will be in the range of 32-bit signed integer ”,要求的是求和结果是32位有符号整数。OJ给出的测试数据的求和结果(n*(n+1)/2)一定是32位整数范围内的,但是(n*(n+1))就不一定了所以n(n+1)在这里不可行另外这题

2017-12-12 19:39:01 424

原创 hdoj 1863 最小生成树(kruskal + 并查集)

题目链接#include#include#includeusing namespace std;struct Edge{ int from, to, w; int next;};int tol, n, m,u,v,w,cop,sum;int head[105];int id[105];Edge edges[10005];//根据顶点估计边数 完全图这里 用有向表示无向 故

2017-12-12 19:13:09 231

原创 PAT 天梯赛 L1-027. 出租 (简单字符串处理)

题目链接#include#include #define MAX 10using namespace std;int book[MAX];int ser(char c, string a){ int i; for(i = 0; i < a.length(); ++i){ if(a[i] == c) return i; } return -1;}int m

2017-12-12 15:18:14 471 1

原创 hdoj 2141 二分 + 优化

题目链接注意 1、D数组(放前面两数组和的数组)的范围是 MAX*MAX  ,之前写成 2*MAX  (提交提示MLE)         2、题目可以少用一个数组B        3、发现数组越界 比附 求和那个循环n,l写错位置 也提示MLE(不知道为啥 数组越界G++提示MLE)#include#include#include#include#include#

2017-12-11 17:40:26 251

原创 hdoj 1180 搜索 + bfs + 优先队列

题目#include#include#define MAX 22#includeusing namespace std;struct Node{ int x, y, s; friend bool operator<(const Node &a, const Node &b){ return a.s > b.s; }};int vis[MAX][MAX];c

2017-12-10 20:49:58 360

原创 二分查找

一、普通二分查找二、查找下界(大于等于key的第一个位置)没找到返回数组长度int low_bound(long long *a, int size,int key){ int l = 0, r = size-1; int mid, pos; while(l < r){ mid = l + (r-l)/2; if(a[mid] < key){ l

2017-12-10 14:38:05 174

原创 hdoj 1597 二分 下界(等差数列)

题目链接MAX根据题目 n(n+1)/2 = INT_MAX  估计出来的#include#include #include#include#include#define MAX 66000using namespace std;int k, n;int g, t;long long a[MAX+1];int main() { // freopen("o

2017-12-10 13:40:36 220

原创 PAT 天梯赛 L1-025 A+B

题目链接#include#include#include#includeusing namespace std;string a, b, t;char buf[1005];int toInt(string s){ int num = 0; for(int i = 0; i < s.length(); ++i){ num = num*10 + (s[i]-'0')

2017-12-09 11:31:12 329

原创 数字字符串与int相互转化

#include#include#include#include#includeusing namespace std; int main() { int n; char str[80]; //str为目标地址 n转化完发送到str int,float,double转换为字符串 保存在str中 scanf("%d",&n); sprintf(str,"%d",

2017-12-09 10:19:06 1830

转载 atoi/atof 字符串转Int/float

头文件必须包含 #include<stdlib.h>atof()、atoi()、atol()、strtod()、strtol()、strtoul() (1)atof函数 atof() 用于将字符串转换为双精度浮点数(double),其原型为:double atof (const char* str);atof() 的名字来源于 ascii to floating point numbers 的

2017-12-09 10:17:24 1392

原创 筛法求素数

筛法求素数(O(nloglogn))#include#includeusing namespace std;int a[100];int vis[100];int prime[100];int n; void getPrime(){ int prime; int ans; for(int i = 2; i <= n; ++i){//数组模拟 ans = prim

2017-12-08 20:55:06 307

原创 POJ 3617 字典序最小

题目链接错误解法:例如 CBAC 得到的将是  CBAC 正确应为 CABC错误原因 是 每次只比较 首尾两个元素 而忽略了总体字典序最小的问题此种 当C相等时应继续比较 B A 进而选择右侧的C而不是当C相等时随便选取一个C for(i = 0, j = n-1; i <= j; ){ if(S[i] < S[j]){ // res[count++] =

2017-12-08 15:07:11 226

原创 hdoj 1016 素数环

DFS1#includeusing namespace std;int n, pre;int vis[23];int p[23];int cnt;int kcase;bool isPrime(int num){ for(int i = 2; i*i <= num; ++i){ if(num%i == 0) return false; } return true;}

2017-12-07 19:03:39 204

原创 欧几里德求最大公约数/最小公倍数

两个数的最大公约数(递归/递推)1、辗转相除法的正确性gcd(a,b)=gcd(b,a mod (b))的证明:           第一步:令c为a和b的最大公约数,数学符号表示为c=gcd(a,b).因为任何两个实数的最大公约数c一定是存在的,也就是说必                             然存在两个数k1,k2使得a=k1*c, b=k2*c          第二步:a...

2017-12-06 19:12:45 607

原创 递归 理解

给n个数 a1,a2,....ak  ,判断是否有其中的一些数的和 等于 k;例如n = 2k = 3集合{1,2}DFS:#includeusing namespace std;#define MAX 1005int a[MAX];int n, k;int flag;int cnt;bool dfs(int cur, int s) { if(cur =

2017-12-03 11:40:31 163

原创 hdoj 1026 搜索

题目链接、#include#include#includeusing namespace std;const int INF = 9999999;const int MAX = 102;struct Node{ int x, y; int step; int prex, prey; char c;};struct cmp{ bool operator ()

2017-12-02 19:42:53 247

原创 CSP 2017_9_4 通信网络

题目链接

2017-12-02 13:15:01 1109

原创 csp 2017_3_3 markdown

题目连接package csp2017_3_3;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String line, preline; line = null;

2017-12-01 21:32:13 220

G:\B_Packages\PycharmProject\ChineseNRE.zip

基于BiLSTM + Attention实现的简单的关系抽取模型,代码效果并不十分理想,代码上传目的是为大家提供基本的实现思路。

2019-11-29

空空如也

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

TA关注的人

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