E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
BOJ
boj
65
Description champ最近在和dalong玩一个取石子游戏,游戏规则很简单:有三堆石子,两人轮流取,每次任选两堆石子,然后从一堆中取走x(x>=1)个石子,另一堆中取走2*x个石子,最后不能取者输掉游戏,champ每一次都先取。 现在,champ告诉你初始三堆石子的数量,他想知道,自己
zsybupt
·
2013-02-17 23:00
BO
boj
439
水题,用到STL map,还是得细心点,不要少写了逻辑上应该的操作。 代码: #include<iostream> #include<map> using namespace std; map<int,int>ElementStore; int main() { int n,m; scanf("%d",&
zsybupt
·
2013-02-15 02:00
BO
boj
19
Description 在一张卡片上面,有N+1个正整数,最后一个数是M,而前N个数都不超过M,设为a1, a2, a3, …, aN, 问是否存在整数x1, x2, x3, …, xN, x(N+1), 满足x1*a1 + x2*a2 +...+ xN*aN +x(N+1)*M = 1。 当确定N和M后,显然一共有M^N张不同的卡片。现在的问题是,在这所有的卡片
zsybupt
·
2013-02-14 22:00
BO
boj
462
dp {i,j}=i*{i,j-1}+i*{i-1,j-1}=i*[{i,j-1}+{i-1,j-1}]; #include<iostream> using namespace std; long long dp[1005][1005];//dp[i][j]表示i条入线,j条出线 int main() { for(int i=0;i<=1000
zsybupt
·
2013-02-14 15:00
BO
boj
16
dfs,另外用dp[k][x1][y1][x2][y2]进行标记 #include<iostream> #include<cmath> using namespace std; #define N 20 double G[10][10],dp[20][10][10][10][10];//棋盘; double e; double f(int x1,int
zsybupt
·
2013-02-13 17:00
BO
boj
312
并查集---可能是我水过最多的算法。。。。 #include<iostream> using namespace std; #define N 50005 #define M 105 int colorClass[N]; int father[M]; int findFather(int i) { if(father[i]!=i) father[i]
zsybupt
·
2013-02-12 00:00
BO
boj
591
蛋疼的晚上打开一道题
boj
591,发现就是辗转相除法,求系数。。。然后先是输出“Not Exist”打错为“No Exist”,后来又少写return 0;狗血。。。。。。
zsybupt
·
2013-02-07 04:00
BO
boj
32
dp,k位的以i∈[0,9]开头的no-decreasing Num的个数为 dp[k][i]=dp[k-1][i]+dp[k-1][i+1]+...+dp[k-1][9], 对于输入的n 只需输出dp[n+1][0]即可 #include<iostream> using namespace std; #define N 66 long long dp[N][10];
zsybupt
·
2013-02-05 21:00
BO
boj
348
水题,读入数据时注意,开始以回车作为结束,发现坑爹,还是计数靠谱,输出格式也要注意 #include<iostream> using namespace std; int main() { int n; scanf("%d",&n); while(n!=1) { int s=0,r=0,c=0; char ch;
zsybupt
·
2013-02-05 18:00
BO
boj
317
只需寻找到连续的两个序列时,一个pawn上去消灭一个rook。但是选取哪个pawn上去的时候要根据以下原则,其实就是为了连续序列时能消灭更多的rook if(curPawnsCol[j]<curPawnsCol[j+1]) curPawnsCol[j+1]--; else curPawnsCol[j]--; 代码: #include&
zsybupt
·
2013-02-05 17:00
BO
boj
24
http://acm.bupt.edu.cn/onlinejudge/newoj/showProblem/show_problem.php?problem_id=24 作为一个水货,只能水过。。。 找时间看下划分树和线段树等算法吧。。。 #include<iostream> #include<algorithm> using namespace std; s
zsybupt
·
2013-02-04 17:00
BO
bupt
boj
第五题
题目 Permutation Accept:217 Submit:706 Time Limit:1000MS Memory Limit:65536KB Description We all know that , when there are n positive integers (namely 1…n) , we ca
narutolby
·
2013-01-11 19:00
UP
bupt
boj
第二题
/************************************************************************* > File Name: 2.c > Author:narutolby > Created Time: 2013年01月02日 星期三 14时34分25秒 *********************************
narutolby
·
2013-01-06 20:00
ACM
[NBOJ0014][PKU3687][Labeling Balls]
[题目要求]http://n.
boj
.me/onlinejudge/newoj/showProblem/show_problem.php?
小弘
·
2012-10-10 21:00
ACM
拓扑排序
贪心算法
LabelingBalls
BOJ
Season Autumn, 2012
转至: http://blog.renren.com/share/256603565/14361820169?from=0101010202&ref=hotnewsfeed&sfet=102&fin=0&ff_id=256603565#nogoA怎么乱搞都能过…标程是用树链剖分写的,然后通过的代码有dfs序列的,看不懂的,乱搞水过的…B数位dp。状态是dfs(i,m,s,e),i为当前做到前i位,
shahdza
·
2012-10-10 00:00
c
boj
-1002-A-B Problem 大数加减法
思路:常规大数加减法,要考虑输入数字为负数情况。用字符串存储数字,处理时,逆序字符串补0对齐。主要考虑进位和借位。ProblemId: 2Submittime: 2012-10-0117:20:42User_id: 478Memory:144K Time:12MSLanguage:G++ Result:Accepted#include #include #include #include u
NEOMc
·
2012-10-01 17:00
user
存储
BOJ
1257 Jim 和 Tradia的故事II-第K小数---初学线段树
/* 功能Function Description:
BOJ
1257 Jim 和 Tradia的故事II-第K小数---初学线段树 开发环境Environment:
·
2012-08-07 11:00
线段树
POJ 1985 &&
BOJ
196 && HDU 2196
树型DP维护从有根树的顶点出发到叶子的最长距离和次长距离(要保证通过不同的孩子)POJ1985#include #include #include #include usingnamespacestd; inthead[40010],cnt; intdp1[40010],dp2[40010]; intans=0; structEdge{ intv,c,next; }edge[80010]; voi
waitfor_
·
2012-08-04 00:00
c
struct
ini
BOJ
1003 Guess
//此题目的难点就在于高精度上了 //微小增量0.001,0.0001,0.00001。。。。。。。都是可以的。 #include #include usingnamespacestd; intall[16390][8]; intcmp(inta,intb){ returna>b; } intN; doublea,b,c; inti,j,num=0; intrank[16390]; intmai
chen895281773
·
2012-05-16 16:00
BOJ
519
Description给定一个正整数X,求一个最小的正整数N,使得N能被X整除。并且N有个性质:其各位数字都相同,比如1111,222222……Input有若干组测试数据,以EOF结束。对于每组测试数据只有一行,包含一个正整数X(0 #include #include #defineinf100000000 usingnamespacestd; intmain(){ inti,j,n; mapmp
waitfor_
·
2012-04-16 18:00
测试
input
ansj
output
BOJ
385
ProblemC.VaccineDescriptionOnChristmasEve,2029,theunidentified"ApocalypseVirus"spreadsandplungesJAintoastateofemergencyinachaosknownasthe"LostChristmas"incident.AninternationalorganizationknownastheGH
waitfor_
·
2012-03-25 13:00
BOJ
396
ProblemK.Alice'sPianoDescriptionAlicehasapianowhichcanplaysnicemusic,butit'sdifferentfromotherpianos.Ithastworowsofkeys,andthemethodofplayingitisalsoquitespecial.WhenAliceplayspiano,shehastoputhertwoh
waitfor_
·
2012-03-24 19:00
BOJ
394
ProblemI.TheLongestSequenceofRectanglesDescriptionArectangleisspecifiedbyapairofcoordinates(x1,y1)and(x2,y2)indicatingitslower-leftandupper-rightcorners(x1 #include #include #include #include usingnam
waitfor_
·
2012-03-24 19:00
再谈二分图最优匹配和最优完备匹配
再来说二分图的带权匹配和二分图的最优匹配 参考http://
boj
.5d6d.com/thread-1382-1-1.html 二分图的带权匹配就是
lt200819
·
2012-03-18 20:00
二分图
BOJ
313 Candy
源向每个小孩连边,容量是该小孩的初始糖数;每个小孩向汇连边,容量是糖的平均数;每个小孩想相邻的格子各连一条边,容量是1.把图建好就很简单了 #include #include #include #defineinf100000000 #definemin(a,b)((a)>(b))?(b):(a) usingnamespacestd; inta,b,map[55][55]; intn,k,dist
waitfor_
·
2012-03-08 23:00
struct
SAP
boj
-311-小马过河
小马过河Accept:16 Submit:35TimeLimit:1000MS MemoryLimit:65536KBDescriptioncloverprince养着一只小马,活泼可爱,很喜欢在外面玩。有一天,小马驮着一袋盐从一条小河上经过,到了河对岸,他发现,身上的盐轻了不少,好像自己的力气变大了似的。从此,小马开始喜欢过河。每天都要经过小河,到河对岸的草地上去玩。有一天,小马玩得
NEOMc
·
2012-03-02 15:00
测试
input
IM
output
BOJ
热身赛 F题 解题报告 [最大流最小割 dinic]
题目在下面链接:点击打开链接F PanicRoomDescriptionYouaretheleadprogrammerfortheSecuritron9042,thelatestandgreatestinhomesecuritysoftwarefromJellernInc.(Motto:WesecureyourstuffsoYOUcan'tevengettoit).Thesoftwareisde
wuyanyi
·
2012-03-01 09:00
BOJ
288
诶,数学弱爆了..比赛时候没推出来组合数学里的母函数(x+x^2+……+x^n)^m的展开式中x^k的系数整理得x^m * (1-x^n)^m * (1-x)^(-m)就可以得到x^k的系数#include intmain() { intn,m,k; while(scanf("%d%d%d",&n,&m,&k)!=EOF) { doubleans=0; if(k
waitfor_
·
2012-02-08 18:00
BOJ
170 Fake Coins
题目地址http://acm.bupt.edu.cn/onlinejudge/newoj/showProblem/show_problem.php?problem_id=170这个题用到信息论里的几个概念。信息量、熵(不会的百度一下)假币可轻可重,每枚硬币都可能是假币。故此问题共有2*n种情况,每种情况的概率为1/(2*n)。所以此问题的熵为log(2*n)/log2。实验最多可能出现三种结果,根
waitfor_
·
2012-01-26 12:00
HDU 4090 GemAnd Prince 暴搜+剪枝
我在搜与某一块相连的方块时,用BFS搜的话用在HDU4989ms险过,在
BOJ
6012ms超时。 然而换成DFS搜在HDU2765ms,在
BOJ
3598ms都过了。
izuoyan
·
2012-01-17 18:00
HDU
o.
boj
1022 SuperRock钟爱的香蕉
注:最近这一系列ACM的内容,都是2年多之前的代码,自己回顾一下。SuperRock钟爱的香蕉Submit:1494 Accepted:943TimeLimit:1000MS MemoryLimit:65536KDescriptionBupt的新水果店开张,有买一赠一的活动,即每买一只大小为A(1 usingnamespacestd; boolcmp(inta,intb){return(
wenlele
·
2011-12-17 00:00
活动
System
input
n2
output
o.
boj
1022 Steps
注:最近这一系列ACM的内容,都是2年多之前的代码,自己回顾一下。StepsSubmit:849 Accepted:294TimeLimit:1000MS MemoryLimit:65536KDescriptionOnestepsthroughintegerpointsofthestraightline.Thelengthofastepmustbenonnegativeandcanbebyo
wenlele
·
2011-12-17 00:00
Integer
System
input
each
output
distance
o.
boj
1501——多彩瓜
注:最近这一系列ACM的内容,都是2年多之前的代码,自己回顾一下。Description dalong的舅舅最近到外地旅游时给dalong带回来一种神奇的水果:多彩瓜。这种瓜太漂亮了,它有很多层,每一层都是一种颜色。由于多彩瓜放久了会变坏,dalong决定每天吃一层,可是多彩瓜有好多层,每天吃一层的话还没吃完多彩瓜就坏了,因为多彩瓜颜色很多,dalong把一些很相近的颜色认为是同一种颜色,这样
wenlele
·
2011-12-16 23:00
c
测试
System
input
旅游
output
BOJ
262 Channel Coding DP
题意:给一串数字,里面只包含0-11三种数字。问和为0的最长连续子串。思路:遍历一遍,求每个i的sum[i],代表从第一个数字到这个数字的和。显然如果sum[i]=sum[j],则从i+1到j这j-i个数字的和=0。即次数所求的D=j-i-1。#include #definemax(a,b)(a>b?a:b) #definemin(a,b)(a=0) { if(pos[data[i]]1) pri
wuyanyi
·
2011-12-15 19:00
BOJ
1923 Hector的面试 I 贪心
题意:水晶数g,农民数目p,每个农民的造价c,起始状态金钱数m,游戏结束的秒数d。每秒每个农民可以制造g个水晶。制造农民不需要时间,任何时刻都行。思路:刚开始以为是dp。其实不然。每一秒内都有固定的p[i]、m[i]。i=0,1,2,3......d;任何时刻都可以生产农民。讨论对于第i秒内,可以生产农民数目为:x=0,1,2,3.....xmax.;(xmax=m[i-1]/c);显然是在第i秒
wuyanyi
·
2011-12-01 20:00
BOJ
1131 Crazy tea party 冒泡排序变形
题意:给一行数字,只能相邻的两个交换位置。为交换多少次之后能使得这行数字里的每个数的左右数字交换。(reverse)。注意!这行数是不是在一行里,是aroundthetable,即是一个环。思路:如果这个不是环的话,很显然,就是冒泡排序。12345冒泡排序成54321交换次数是n*(n-1)/2。但是关键点也是蛋疼点就是这个是环:当时做的时候是写了不少数组都算看看,猜出蹊跷点。这里让我想到我一个获
wuyanyi
·
2011-12-01 17:00
table
BOJ
1293 小马过河 dp
题意:给一个矩阵。从上到下一样,(题目里说的是从下到上,但是其实一样)代码里面就是从上到下考虑。每一行到下一行都只有三个选择,左下,下,右下。所以转移方程为:dp[i][j]=min(dp[i-1][j-1],dp[i-1][j],dp[i-1][j+1])+w[i][j];因为dp还很不熟练。刚看到题目的时候其实第一反应是类似广搜的去模拟一下差不多,反正每一格只会影响下一行的三格。然后写的时候就
wuyanyi
·
2011-12-01 16:00
BOJ
1499 合法食物链 floyd
题意:很好懂。其实就是大小关系,如果a>b,b>c如果再出现个c>a即不合法。思路:floyd传递闭包。floyd的典型应用了。floyd处理之后,如果mat[a][a]=true,即可说明出现了闭环。即不合法。#include usingnamespacestd; constintN=105; intn,m; boolmat[N][N]; voidfloyd() { for(intk=1;k<=
wuyanyi
·
2011-12-01 16:00
BOJ
1509 海边 dijstra 最短路
题意:这题题目写得够坑的。前面一大串都是无关信息。其实很简单,就是在二维坐标里面给出若干个圆(阴影),给出起始点和终止点。问从起始点到终止点,怎么走可以使暴露在非阴影下的路径最短。输出最短路的值。思路:其实很简单,刚一看,设计到圆面积感觉比较有点蒙,其实圆可以当成点来处理,如果要进去某个圆。则朝着这个圆的圆心的直线方向走肯定是最短。所以就可以抽象成一个图。每个圆也是一个点。点与点的路径和圆半径有关
wuyanyi
·
2011-12-01 16:00
boj
23 Easy problem
问题: Description There is N pairs of balls in a small box. That means the number for each pair is the same. However, for some reason, a ball is lost. Now, you will get the number of the rest.
handspeaker
·
2011-11-30 20:00
AS
HDU 4087 &
BOJ
244 A Letter to Programmers 【三维仿射变幻的齐次矩阵乘+快速幂】
HDU4087&
BOJ
244ALettertoProgrammers【三维仿射变幻的齐次矩阵乘+快速幂】题意很裸,亮点在于将齐次仿射变换矩阵和快速幂结合起来。
From A Start,As An Acmer
·
2011-11-07 19:00
BOJ
247 Gem And Prince [剪枝爆搜][36th ACM/ICPC Beijing Regional Onsite J]
BOJ
247GemAndPrince[剪枝爆搜][36thACM/ICPCBeijingRegionalOnsiteJ]这题我出的,因为邀请赛时候出了道题意有点问题的模板题,所以这次决定出一道题意清楚的非模板题
From A Start,As An Acmer
·
2011-10-26 14:00
nosql cluster
1. http://www.taobaodba.com/html/525_525.html 2. http://
boj
.github.com/blog/2011/01/14/lvs-nginx-nodejs-mongodb-cluster-setup-on-rackspace
ggsonic
·
2011-09-29 22:00
cluster
BOJ
1790 Blow up the bridge 【弧扫描】
BOJ
1790Blowupthebridge【弧扫描】链接:http://o.
boj
.me/onlinejudge/showproblem.php?
From A Start,As An Acmer
·
2011-09-24 20:00
BOJ
212 树的先序遍历
http://
boj
.me/onlinejudge/newoj/showProblem/show_problem.php?
alongela
·
2011-09-19 11:00
c
boj
220(状态压缩DP)
TourismPlanningAccept:39 Submit:170TimeLimit:1000MS MemoryLimit:65536KBDescriptionSeveralfriendsareplanningtotaketourismduringthenextholiday.Theyhaveselectedsomeplacestovisit.Theyhavedecidedwhic
fp_hzq
·
2011-09-18 21:00
input
each
output
pair
Numbers
boj
212(栈模拟)
EliminateWitches!Accept:9 Submit:38TimeLimit:1000MS MemoryLimit:65536KBDescriptionKanameMadokaisaMagicalGirl(MahouShoujo/PuellaMagi).ThedutyofaMagicalGirlistoeliminateWitches(Majo).Thoughsoundsh
fp_hzq
·
2011-09-18 21:00
boj
215(树形DP)
GeoDefenseAccept:6 Submit:27TimeLimit:5000MS MemoryLimit:65536KBDescriptionTowerdefenseisakindofreal-timestrategycomputergames.Thegoaloftowerdefensegamesistotrytostopenemiesfromreachingyourbases
fp_hzq
·
2011-09-18 21:00
最长上升子序列NLOGN算法
http://
boj
.me/onlinejudge/showproblem.php?
qq675927952
·
2011-07-26 23:00
算法
input
任务
旅游
output
BOJ
1295 ACM system 【可修改堆】
BOJ
1295ACMsystem【可修改堆】ACMsystemLoginandstarit!
From A Start,As An Acmer
·
2011-07-05 13:00
上一页
1
2
3
4
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他