- 博客(90)
- 收藏
- 关注
原创 hihocoder 1680 hiho字符串2
#1680 : hiho字符串2时间限制:10000ms单点时限:1000ms内存限制:256MB描述我们定义第一代hiho字符串是"hiho"。 第N代hiho字符串是由第N-1代hiho字符串变化得到,规则是:h -> hio i -> hi o -> ho 例如第二代hiho字符串是: hiohihioho 第三代是: ...
2018-10-18 13:31:50
283
原创 hihocoder 1689 推断大小关系 并查集+dfs
#1689 : 推断大小关系时间限制:20000ms单点时限:2000ms内存限制:256MB描述有N个整数A1, A2, ... AN,现在我们知道M条关于这N个整数的信息。每条信息是:Ai < Aj 或者 Ai = Aj 小Hi希望你能从第一条信息开始依次逐条处理这些信息。一旦能推断出A1和AN的大小关系就立即停止。 输出在处理第几条时第一次推断出A1...
2018-10-17 17:21:27
209
原创 hihocoder 1766
#1766 : 字符串问题时间限制:20000ms单点时限:1000ms内存限制:256MB描述一开始小 Hi 有一个空的字符串 T ,现在他想进行最少次数的操作使得 T 变成 S,操作有以下两种:1.任选一个字符,将它加到 T 的最后面2.选择 T 的一个子序列,将它加到 T 的最后面定义一个串 A 是串 B 的子序列当且仅当串 A 可以由串 B 删掉某些位置后得...
2018-10-11 19:00:05
311
原创 hihocoder 1601 最大得分
#1601 : 最大得分时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi和小Ho在玩一个游戏。给定一个数组A=[A1, A2, ... AN],小Hi可以指定M个不同的值S1,S2, S3 ... SM,这样他的总得分是 ΣSi × count(Si)。(count(Si)是数组中与Si相等的元素的个数)。为了增加难度,小Ho要求小Hi选择的S1...
2018-10-11 11:24:30
251
原创 hihocoder 1577
#1577 : 为了Hiho的荣耀时间限制:10000ms单点时限:1000ms内存限制:256MB描述Hiho王国受到外敌入侵,为了Hiho的荣耀,国王决定组织骑兵反击。一个骑兵单位由一个兵和一匹马组成,其战斗力为1。单个的兵、单个的马或两个兵、两个马都不是骑兵单位,故没有战斗。国王发现他的兵马排成了有序的 A、B两行,每一行中都既可能有兵,又可能有马。国王宣布了本次反击...
2018-10-10 21:20:43
191
1
原创 最小二乘法简介
最小二乘法(又称最小平方法)是一种数学优化技术。它通过最小化误差的平方和寻找数据的最佳函数匹配。利用最小二乘法可以简便地求得未知的数据,并使得这些求得的数据与实际数据之间误差的平方和为最小。最小二乘法还可用于曲线拟合。假设X[i]为输入的第i个样本向量,y[i]为对应第i个样本的观测值,那么the least squared error 实际上是使(g(x[i])-y[i])的平方和最
2017-10-13 16:55:50
941
原创 hihocoder 1372 平方求和
#include using namespace std;const int mx=1000000001+100000;int n;vector g;int dfs(int num,int cnt,int limit){ if(num==0) return 0; int p=upper_bound(g.begin(),g.end(),num)-g.begin()-1;
2017-02-01 19:18:39
409
原创 hihocoder 1110 正则表达式
#1110 : 正则表达式时间限制:1000ms单点时限:1000ms内存限制:256MB描述给定一个字符串,判断其是否为合法的正则表达式。 一个正则表达式定义为: 1:0是正则表达式,1也是正则表达式。 2:P和Q都是正则表达式,则PQ是正则表达式。 3:P是正则表达式,则(P)是正则表达式 4:P是正则表达式,则P
2015-11-05 20:35:14
656
原创 hihocoder 1145
#1145 : 幻想乡的日常时间限制:20000ms单点时限:1000ms内存限制:256MB描述幻想乡一共有n处居所,编号从1到n。这些居所被n-1条边连起来,形成了一个树形的结构。每处居所都居住着一个小精灵。每天小精灵们都会选出一个区间[l,r],居所编号在这个区间内的小精灵一起来完成一项任务。特别的,居所相邻的(有边相连的)
2015-11-03 20:05:21
357
原创 hihocoder 诺兹多姆
时间限制:1000ms单点时限:1000ms内存限制:256MB描述wuzhengkai是一个炉石传说玩家。有一天,他碰到对面上了个诺兹多姆并上了嘲讽和圣盾。诺兹多姆是一个有8点攻击力和8点生命值的随从,这意味着他能够承受总量小于8点的伤害而不死亡,且对于任何攻击他的单位造成8点伤害。嘲讽意味着当诺兹多姆死亡之前你不能攻击对方玩家。圣盾意味着诺兹
2015-11-03 18:29:01
1040
原创 hihocoder 1157 : 建造金字塔
#includeusing namespace std;const int mx=1000+100;typedef long long ll;const ll INF =10000000000000;int T,n;ll sum[mx],dp[mx][mx];struct JZT{ ll x,y,ex,w;}a[mx];bool cmp(const JZT &f,
2015-10-28 00:17:07
440
原创 hihocodxer1187 Divisors
时间限制:10000ms单点时限:1000ms内存限制:256MB描述Given an integer n, for all integers not larger than n, find the integer with the most divisors. If there is more than one integer with the same
2015-10-27 19:06:36
964
原创 hihocoder 1238 Total Highway Distance
时间限制:10000ms单点时限:1000ms内存限制:256MB描述Little Hi and Little Ho are playing a construction simulation game. They build N cities (numbered from 1 to N) in the game and connect them by N-
2015-10-24 16:48:20
831
原创 hdu 5486 Difference of Clustering
#include #include#include#include#include#include#includeusing namespace std;const int mx=1000000+1000;typedef long long ll;int T,n,deg[mx*2];map mp1,mp2;vector g[mx*2];void init(){
2015-09-28 21:47:24
490
原创 uva 12219 Common Subexpression Elimination
#include #include#include#include#include#include#include#includeusing namespace std;const int mx=50000+1000;int T,num,p;char name[mx][10] ,s[mx*10];bool used[mx];vector g[mx];struct no
2015-09-14 20:36:14
502
原创 uva 1471 Defense Lines
Defense LinesTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionAfter the last war devastated your country, you - as
2015-08-15 15:33:37
299
原创 hdu 5385 The path
Problem DescriptionYou have a connected directed graph.Let d(x) be the length of the shortest path from 1 to x.Specially d(1)=0.A graph is good if there exist x satisfy d(1)d(2)....d(x)>d(x+1)>...d(n)
2015-08-13 21:38:28
394
原创 uva 12118 Inspector's Dilemma
In a country, there are a number of cities. Each pair of city is connected by a highway, bi-directional ofcourse. A road-inspector’s task is to travel through the highways (in either direction) and to
2015-08-10 20:47:33
472
原创 uva 215 Spreadsheet Calculator
A spreadsheet is a rectangular array of cells. Cells contain data or expressions that can be evaluated toobtain data. A “simple” spreadsheet is one in which data are integers and expressions are mixed
2015-08-10 16:17:18
590
原创 uva 806 Spatial Structures
#include #include#include#include#include#includeusing namespace std;int n;char mp[100][100];int base[100],Cases=0;vector ans;void init(){ base[0]=1; for(int i=1;i<=10;i++) base[
2015-08-09 16:32:54
317
原创 UVA 1103
DescriptionIn order to understand early civilizations, archaeologists often study texts written in ancient languages. One such language, used in Egypt more than 3000 years ago, is based on charact
2015-08-03 14:59:50
414
原创 hdu 1364 Illusive Chase
刚开始我还很怀疑我的想法,后来百度没发现题解,看到discuss里面说数据很弱,于是我就大胆的写了个暴力,每次枚举一个点找到一次到合法终点的合法路径是,结束dfs,简单暴力代码如下#include #include#includeusing namespace std;const int mx=111;int mp[mx][mx],T,n,m,num,ans;bool use
2015-08-01 13:43:32
625
原创 hdu1052
#include #include#include#include#includeusing namespace std;const int mx=2100;int n,tj[mx],king[mx],match[mx];vector g[mx] ,tj0,king0;;bool used[mx];int main(){ while(scanf("%d",&n),
2015-07-31 16:11:21
401
原创 hihocoder1182欧拉回路
#include #include#include#include#includeusing namespace std;int n,base;vector path;bool used[1000000];void init(){ base=1; for(int i=2;i<n;i++) base=(base<<1)+1; memset(use
2015-07-24 19:51:22
401
原创 hihocoder1181 欧拉回路二
在上一回中小Hi和小Ho控制着主角收集了分散在各个木桥上的道具,这些道具其实是一块一块骨牌。主角继续往前走,面前出现了一座石桥,石桥的尽头有一道火焰墙,似乎无法通过。小Hi注意到在桥头有一张小纸片,于是控制主角捡起了这张纸片,只见上面写着:将M块骨牌首尾相连放置于石桥的凹糟中,即可关闭火焰墙。切记骨牌需要数字相同才能连接。——By 无名的冒险者小Hi和小Ho打开了主角的道具
2015-07-24 17:03:59
347
原创 hihocoder1178 计数
#include #include#include#includeusing namespace std;int n,L,R;int main(){ scanf("%d",&n); scanf("%d%d",&L,&R); int x=1; while(x<R) { x*=2; } x=x/n+1;
2015-07-24 16:16:13
362
原创 hdu5294 Tricks Device 多校联合赛
#include #include#include#include#include#include#includeusing namespace std;typedef pair P;const int INF =10000000;int n,m,d[2100],mp[2100][2100],num,nmp[2100][2100];struct edge{ in
2015-07-21 21:15:59
328
原创 hdu1175 连连看
#include #include#include#includeusing namespace std;int n,m,q,mp[1100][1100];bool used[1100][1100];int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};int x1,x2,y1,y2;void dfs(int x,int y){ used[x]
2015-06-22 12:04:55
353
原创 hdu1100
#include #include#include#includeusing namespace std;int n,op[40],sum[40];void init(){ memset(op,0,sizeof(op)); op[1]=sum[1]=1;op[0]=1;sum[0]=0; for(int i=2;i<20;i++) {
2015-06-14 16:13:02
600
原创 hihocoder 1099 Constellations
#include #include#include#include#includeusing namespace std;struct P{ int x,y; P(){} P(int x,int y):x(x),y(y){} P operator - (const P &t) { return P(x-t.x,y-t.y);
2015-05-13 01:28:43
401
原创 hihocoder 1093
#include #include#include#include#include#includeusing namespace std;const int INF=1100000000;const int mx=100000+1000;struct edge{ int to,cost;}e;vector g[mx];int n,m,s,t,d[mx];bool
2015-05-12 19:25:43
408
原创 hihocoder#1054 : 滑动解锁
#include #include#include#include#include#includeusing namespace std;int T,m,a[10],ans;vector mg[10];int g[10][10];bool used[10];void init(){ memset(g,0,sizeof(g)); g[1][3]=g[3][
2015-05-10 20:48:55
729
原创 poj1236 Network of Schools
#include #include#include#include#includeusing namespace std;int n;bool used[150];vector g[150],rg[150],vs,v;void dfs(int v,vector& vs){ used[v]=true; for(int i=0;i<g[v].size();i++)
2015-03-06 17:34:32
241
原创 poj3420
#include #include#include#include#includeusing namespace std;typedef vector vec;typedef vector mat;int n,m;mat mul(mat &a,mat &b){ mat c(a.size(),vec(b[0].size())); for(int i=0;i<a.
2015-03-05 20:30:04
524
原创 poj3411
#include #include#include#include#includeusing namespace std;const int INF=100000000;int n,m,d[1500][20];struct edge{ int to,p,r,c;};struct state{ int cost,s,v; state(int cost,
2015-03-05 17:03:03
400
原创 poj3254
#include #include#include#includeusing namespace std;const int M=100000000;int n,m,state[1000],bad[20],top,dp[1000][20];void init(){ int s=1<<m; top=0; for(int i=0;i<s;i++) {
2015-03-05 14:47:59
205
原创 poj1050
#include #include#include#includeusing namespace std;int n,a[105][105],dp[105][105],row[105];int main(){ int ans=-12700000; scanf("%d",&n); for(int i=1;i<=n;i++) { for(
2015-03-01 17:53:04
258
原创 poj3233矩阵的幂的和
#include #include#include#includeusing namespace std;int n,k,m;typedef vector vec;typedef vector mat;mat mul(mat &a,mat &b){ mat c(a.size(),vec(b[0].size())); for(int i=0;i<a.size();
2015-03-01 14:22:19
248
原创 poj3734
#include #include#include#includeusing namespace std;const int M=10007;typedef vector vec;typedef vector mat;int T,n;mat mul(mat &a,mat &b)//a*b{ mat c(a.size(),vec(b[0].size())); fo
2015-03-01 13:05:17
414
原创 poj1113Wall
#include #include#include#include#include#define PI 3.14159265358979323846using namespace std;const int MAX=1050;struct P{ int x,y; P() { } P(int x1,int y1) {
2015-02-25 18:12:19
264
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人