- 博客(41)
- 收藏
- 关注
原创 2020nlp算法秋招上岸流水账+面经
个人经历博主之前是一个acm铜牌辣鸡,拿过几次铜首极其遗憾,于是决定去读个研究生找个地方再战。博主是那种又菜瘾又大的人,所以大四(2018年)没有秋招还在那打比赛(还打过一个铁),比赛打完只能春招了...
2020-11-04 18:52:53 2313 7
原创 2017多校第9场
1002 离线询问,把每个询问变成 q[b]-q[a-1] ,抄一个树链剖分的模板#include<cstdio>#include<cstring>#include<cstdlib>#include <algorithm>#include<iostream>#define inf 0x7fffffff#define N 400005#define M 400005#define l
2017-08-22 19:31:29 331 1
原创 2017百毒之星第一场
A题 答案为p^n mod b = 1的个数,就是d(p-1)#include <iostream>#include <bits/stdc++.h>#define ll long longusing namespace std;int main(){ int T; scanf("%d",&T); ll n; while (T--) {
2017-08-12 18:54:41 231
原创 百毒之星资格赛A题
很巧妙的建图题 度度熊保护村庄 Problem Description 哗啦啦村袭击了喵哈哈村!度度熊为了拯救喵哈哈村,带着自己的伙伴去救援喵哈哈村去了!度度熊与伙伴们很快的就过来占据了喵哈哈村的各个军事要地,牢牢的守住了喵哈哈村。但是度度熊发现,这是一场旷日持久的战斗,所以度度熊决定要以逸待劳,保存尽量多的体力,去迎战哗啦啦村的战士。于是度度熊决定派尽量多的人去休息,但是同时也不能
2017-08-09 15:59:50 305
原创 ac自动机与状态转移
AC自动机是一个确定性有限状态自动机 形式定义 · 定义:有限状态自动机(FA—finite automaton)是一个五元组: – M=(Q, Σ, δ, q0, F) · 其中, – Q——状态的非空有穷集合。∀q∈Q,q称为M的一个状态。 – Σ——输入字母表。 – δ——状态转移函数,有时又叫作状态转换函数或者移动函数,δ:Q×Σ→Q,δ(q,a)=p。 – q0——M的开始
2017-07-18 00:19:45 674
原创 ac自动机与状态转移
AC自动机是一个确定性有限状态自动机 形式定义 · 定义:有限状态自动机(FA—finite automaton)是一个五元组: – M=(Q, Σ, δ, q0, F) · 其中, – Q——状态的非空有穷集合。∀q∈Q,q称为M的一个状态。 – Σ——输入字母表。 – δ——状态转移函数,有时又叫作状态转换函数或者移动函数,δ:Q×Σ→Q,δ(q,a)=p。 – q0——M的开始
2017-07-18 00:18:18 637
原创 hdu 5441
#include <iostream>#include <string.h>#include <set>#include <cstdio>#include <algorithm>#define ll long long#define N 20005#define M 100005using namespace std;int father[N];int find(int x){
2017-03-20 13:00:11 211
原创 hdu 5492
#include <iostream>#include <cstring>using namespace std;double f[35][35],a[35][35],b[35][35],ans,Max,Min,Exp,ave;int i,j,n,m;int main(){ int c=0,T; cin>>T; while (T--){ c++;
2017-03-20 12:59:21 246
原创 hdu 5528
#include <iostream>#include <cstdio>#include <cmath>#include <algorithm>#include <cstring>#include <string>#include <vector>#include <map>#include <stack>#include <queue>#include <set>using
2017-03-20 12:58:37 247
原创 hdu 5572
#include <iostream>#include <cstdio>#include <string.h>#include <algorithm>#include <map>#include <queue>#include <stdlib.h>#include <cmath>#include <vector>#include <stack>#define clr(x) mems
2017-03-20 12:57:34 331
原创 hdu 5583
#include <iostream>#include <string.h>#include <cstdio>using namespace std;long k=0,pos[200000];long long calc(string s){ long long pre,sum=0,c,i,len=0; pre=s[0]-'0'; for (i=0;i<s.l
2017-03-20 12:56:43 276
原创 hdu 5651
#include <iostream>#include <string.h>using namespace std;typedef __int64 lld;string s;lld T,factor[1010],ans,k,num[550],odd,level;lld n, m, p;lld Ext_gcd(lld a,lld b,lld &x,lld &y){ if(b==0)
2017-03-20 12:55:51 186
原创 hdu 5738
#include <cmath>#include <cstdio>#include <cstring>#include <algorithm>#include <math.h>#include <iostream>#define ll long long#define mod 1000000007using namespace std;int n,maxx;double s[10
2017-03-20 12:54:24 219
原创 hdu 5755
#include <iostream>#include <cstdio>#include <algorithm>#include <vector>#include <cstring>#include <cstdlib>#include <string>#include <cmath>#include <set>#include <map>#include <bitset>usin
2017-03-20 12:53:37 206
原创 hdu 5794
#include <algorithm>#include <cstdio>#include <vector>#include <iostream>using namespace std;const int mod = 110119;long long fac[mod];long long inv[mod];long long facinv[mod];void init(){ fa
2017-03-20 12:51:50 263
原创 hdu 5800
#include <iostream>#include <cstdio>#include <string.h>#include <algorithm>#include <map>#include <queue>#include <stdlib.h>#include <cmath>#include <vector>#include <stack>#define clr(x) mems
2017-03-20 12:51:15 212
原创 hdu 5818
#include <iostream>#include <cstdio>#include <string.h>#include <algorithm>#include <map>#include <queue>#include <stdlib.h>#include <cmath>#include <vector>#include <stack>#define clr(x) mems
2017-03-20 12:50:04 169
原创 hdu 5828
#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <cstdlib>#include <cctype>#include <string>#include <iostream>#include <vector>#include <map>#include <set>#in
2017-03-20 12:49:21 189
原创 hdu 5833
#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;#define maxn 105#define mod 1000000007int A[305][305];int num_prime,prime[400],f[2005];void getprime(){ for (in
2017-03-20 12:48:31 249
原创 hdu 5877
#include <iostream>#include <cstdio>#include <vector>#include <cmath>#include <string>#include <string.h>#include <algorithm>using namespace std;#define LL __int64#define eps 1e-8#define lson
2017-03-20 12:44:18 167
原创 hdu 5894
#include <bits/stdc++.h>const long long mod=1e9+7;const int N = 1000005 ;long long n , m , k ;long long pw[N];void init(){ pw[0]=1; for (int i = 1 ; i < N ; i++) pw[i]=pw[i-1]*i % mod
2017-03-20 12:43:36 314
原创 hdu 5895
#include <iostream>#include <cstdio>#include <string.h>#include <algorithm>#include <map>#include <queue>#include <stdlib.h>#include <cmath>#include <vector>#include <stack>#define clr(x) mems
2017-03-20 12:42:51 255
原创 Lehmer快速求1e11以内质数个数
#include<cstdio>#include<cmath>using namespace std;#define LL long longconst int N = 5e6 + 2;bool np[N];int prime[N], pi[N];int getprime(){ int cnt = 0; np[0] = np[1] = true; pi[0]
2017-03-20 12:42:11 388
原创 hdu 5971
#include <iostream>#include <cstdio>#include <cmath>#include <string.h>#include <queue>#include <stack>#include <algorithm>#include <fstream>#define ll long long#define INF 0x3f3f3f3f#define c
2017-03-20 12:40:46 192
原创 hdu 5971
#include <iostream>#include <cstdio>#include <cmath>#include <string.h>#include <queue>#include <stack>#include <algorithm>#include <fstream>#define ll long long#define INF 0x3f3f3f3f#define c
2017-03-20 12:40:08 291
原创 hdu 5976
#include <iostream>#include <cstdio>#include <cmath>#include <string.h>#include <queue>#include <stack>#include <algorithm>#include <fstream>#define ll long long#define INF 0x3f3f3f3f#define c
2017-03-20 12:39:20 197
原创 Sa求法
#include <iostream>#include <cstdio>#include <math.h>#include <algorithm>#include <string.h>using namespace std;const int MAXN=20010;int t1[MAXN],t2[MAXN],c[MAXN];bool cmp(int *r,int a,int b,int
2016-04-27 16:37:36 534
原创 hdu1077 catching fish
Problem Description Ignatius likes catching fish very much. He has a fishnet whose shape is a circle of radius one. Now he is about to use his fishnet to catch fish. All the fish are in the lake, and
2016-03-13 14:02:49 413
原创 hdu 4390
题意:Given a number sequence b1,b2…bn. Please count how many number sequences a1,a2,…,ansatisfy the condition thata1∗a2∗…∗an=b1∗b2∗…∗bn(ai,bi>1).一般人都能想到把所有的b分解质因数,但是很蛋疼的是我不知道接下来怎么办了。看了题解才明白。首先我们会得到X个质因数
2016-03-04 17:00:55 241
原创 hdu 4393
好久没写了由于不会优先队列,比较难受考虑到Fi只有500以内,我一开始感觉是线性规划。设Yi=kix+b 取任意两条直线的交点 x=(b1-b2)/(k1-k2)x的最大值就是499所以任意两条直线的交点在500以内,所以在500S之后与直线的高度相关的只有斜率,也就是斜率越大直线的高度越大代码掉了
2016-03-04 16:50:55 312
原创 hdu1045
水,随便搜#include <iostream>#include <string.h>using namespace std;int f[10][10],dp[10][10],n,ans,vis[10][10];bool check(int x,int y){ int i,j; if (f[x][y]==-1) return false; if (x<1||x>n) r
2015-12-12 15:16:32 281
原创 hdu 1269 这题有毒
用并查集写的 题目有毒 n=1,m=0都能输入,简直了#include<stdio.h>#include<string.h>int pre_forward[100010],pre_back[100010];int n,m;int find1(int a){ int r=a; while(r!=pre_forward[r]) { r=pre_forw
2015-12-10 15:31:49 241
原创 hdu 1856
并查集随便写 数据大的时候递归find比 while快 就这样#include <iostream>#include <cstdio>using namespace std;struct A{ int father; int num;}set[100010];int find(int x){ if(set[x].father == x) re
2015-12-10 15:15:47 242
原创 hdu1077模拟
解析几何,用参数方程解#include <iostream>#include <math.h>using namespace std;typedef struct P{ double x; double y;};double dist(P p1,P p2){ return sqrt((p1.y-p2.y)*(p1.y-p2.y)+(p1.x-p2.x)*(p1.
2015-11-28 20:25:56 439
原创 poj1014数据很奇怪DISCUSS更奇怪
写了一个多小时的DFS感觉对了各种WA,进discuss找数据发现神奇取模方法,不过这个取模方法明显有问题,再找了别人的DFS秒杀代码,感觉他们的代码也明显有问题,我自己试了好多数据都是对的可是就是WA,还是用DP写的好,不会WA。 但是也不是简单的DP,求可达的范围那个DP其实和DFS是一样的,大不了没有用递归来实现,好像多重背包才是正解。附上我的吃屎代码,迷之WA#include <iostr
2015-11-27 15:08:10 369
原创 HDU5492——合肥1009
题目意思是找一条方差最小的路径 记得以前做过最小方差生成树,这题要解最小方差路径也是差不多的。方差与期望相关,而期望和选择的路径相关所以没法直接用期望来求,我用的方法和最小方差生成树的方法一样,就是枚举所有可能的期望值来计算最小的方差。 可以证明,当枚举的期望使得方差最小时,这条路径一定是方差最小的路径,然而我并不会证明,我只是记住了结论。所以做这个题目的时候先走两遍DP把最大路径和最小路径求出
2015-11-26 14:26:53 542
原创 poj1002
变态高精度乘法,难度在于各种奇奇怪怪的输入,去年好像改了七八天才过,要是比赛有这题肯定是各队的一道大坎 算法难度不大,编程难度极大#include <stdio.h>int mark=0,lock=0;void check(char s1[]){ int len,i; len=strlen(s1); i=0; while (s1[i]=='0') i++;
2015-11-26 11:54:16 190
原创 文章标题
poj1010和poj1011太像了所以暑假那天好像一起写了。POJ1010j的题目很长读的人吐血 题意大概是这样: 你要给集邮公司弄一个算法帮他们满足每个顾客的要求 第一行是邮票的面值,即便面值相同邮票的图案也不相同所以是不同的邮票 第二行是顾客的需求,需要用小于等于4张的邮票来满足。 有多种解的话要求 1.类型数最多。 2.如果类型数相同,则张数少者。 3.如果张数也相同,则
2015-11-25 22:07:51 235
原创 poj1011
今天忙死宝宝,写了几千字的读后感,又踢球又上课没时间刷题了,传一份之前的题解凑个数poj1011题意大概是george这个傻吊拿了若干根,每根木棍切成了若干份,让你求最小的原始长度我记得我暑假写了,改了有三四天才过的。大概的思路是这样:1.答案必定是在所有切好的木棍的长度和的各个因子中产生的,要求最小的所以从1以外最小的因子开始枚举答案。2.先用长度大的木棍,当长度大的木棍都不能组成正确答案的时候再
2015-11-25 21:46:22 365
原创 bitsit维护的flyod
用flyod求传递闭包时只需逻辑与,所以用bitsit来维护的话可以在n^2内完成。基本上5000左右的复杂度都没有问题。void floyd(){ int i,j,k; for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { if(edge[j][i]) edge[j]|=edge[i];
2015-11-24 13:22:23 270
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人