自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

kongming_acm的专栏

如果不能正常显示代码 ,请右键->查看源文件 来查看源代码 里面有代码部分 另外由于网站原因 \n在博客里都显示是/n 请自己更改

  • 博客(68)
  • 资源 (7)
  • 收藏
  • 关注

原创 高斯消元法模板

<br />Sgu 275 To xor or not to xor<br />http://acm.sgu.ru/problem.php?contest=0&problem=275<br />题解:<br />http://hi.baidu.com/czyuan%5Facm/blog/item/be3403d32549633d970a16ee.html<br /> <br />这里提供下自己写的还算满意的求解整数线性方程组的模板(浮点数类似,就不提供了)~~<br /> <br />/* 用于求整数解得方

2010-09-30 20:41:00 1141

原创 1830 开关问题 开灯问题 高斯消元法(mod2)

开关问题Time Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2033 Accepted: 654Description有N个相同的开关,每个开关都与某些开关有着联系,每当你打开或者关闭某个开关的时候,其他的与此开关相

2010-09-30 19:32:00 1403

原创 1222 EXTENDED LIGHTS OUT 开灯问题 高斯消元法(mod2)

EXTENDED LIGHTS OUTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2591 Accepted: 1751DescriptionIn an extended version of the gam

2010-09-30 18:58:00 668

原创 1753 Flip Game 开灯问题 枚举方法

Flip GameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11028 Accepted: 4694<br />DescriptionFlip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one

2010-09-30 13:13:00 471

原创 1681 Painter's Problem 开灯问题 枚举方法

Painter's ProblemTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2267 Accepted: 1119<br />DescriptionThere is a square wall which is made of n*n small square bricks. Some bricks are white while some bricks are yellow. Bob is a painter and he want

2010-09-30 13:04:00 652

原创 1222 EXTENDED LIGHTS OUT 开灯问题 枚举方法

EXTENDED LIGHTS OUTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2590 Accepted: 1750<br />DescriptionIn an extended version of the game Lights Out, is a puzzle with 5 rows of 6 buttons each (the actual puzzle has 5 rows of 5 buttons each). Each

2010-09-30 12:42:00 1321

原创 2244 Eeny Meeny Moo 约瑟夫问题

Eeny Meeny MooTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1885 Accepted: 1284<br />DescriptionSurely you have made the experience that when too many people use the Internet simultaneously, the net becomes very, very slow. <br />To put an end

2010-09-29 21:20:00 604

原创 1012 Joseph 约瑟夫问题 总结了一个公式 n人报m第t轮出列的人的编号(从0到n-1)

JosephTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 31555 Accepted: 11826<br />DescriptionThe Joseph's problem is notoriously known. For those who are not familiar with the original problem: from among n people, numbered 1, 2, . . ., n, standin

2010-09-29 21:09:00 1737

原创 1781 In Danger 约瑟夫问题 枚举超时,需找规律

In DangerTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 2639 Accepted: 1401<br />DescriptionFlavius Josephus and 40 fellow rebels were trapped by the Romans. His companions preferred suicide to surrender, so they decided to form a circle and to

2010-09-29 20:43:00 538

原创 3517 And Then There Was One 约瑟夫问题

And Then There Was OneTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 3136 Accepted: 1562<br />Description<br />Let’s play a stone removing game.<br />Initially, n stones are arranged on a circle and numbered 1, …, n clockwise (Figure 1). You are

2010-09-29 20:08:00 614

原创 sgu 106. The equation 已知ax + by + c = 0 ,求解在[x1,x2],[y1,y2]区间的解的个数

<br />106. The equation <br />time limit per test: 0.50 sec. <br />memory limit per test: 4096 KB <br /> <br />There is an equation ax + by + c = 0. Given a,b,c,x1,x2,y1,y2 you must determine, how many integer roots of this equation are satisfy to the foll

2010-09-29 19:40:00 1343

原创 2115 C Looooops 拓展欧几里得

C LooooopsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8812 Accepted: 1969<br />DescriptionA Compiler Mystery: We are given a C-language style for loop of type <br />for (variable = A; variable != B; variable += C)<br /> statement;<br />I.e

2010-09-29 17:16:00 583

原创 2992 Divisors 求C(N,K)的因子个数

DivisorsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6785 Accepted: 1781<br />DescriptionYour task in this problem is to determine the number of divisors of Cnk. Just for fun -- or do you need any special reason for such a useful computation?

2010-09-27 21:57:00 875

原创 3358 Period of an Infinite Binary Expansion 给出十进制数p和q,将p/q表示成二进制小数,并求出二进制小数的循环节起始位置和循环节的长度 欧拉函数

Period of an Infinite Binary ExpansionTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1461 Accepted: 313<br />Description<br />Let {x} = 0.a1a2a3... be the binary representation of the fractional part of a rational number z. Suppose that {x} is p

2010-09-27 20:23:00 967

原创 3090 Visible Lattice Points 一个(n+1)*(n+1)的点阵,问多少点能被点(0,0)看到 欧拉函数

Visible Lattice PointsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3212 Accepted: 1761<br />Description<br />A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible from

2010-09-27 18:53:00 708

原创 2773 Happy 2006 输入m和k,让你求从小到大排列,第k个与m互素的正整数

Happy 2006Time Limit: 3000MS Memory Limit: 65536KTotal Submissions: 5108 Accepted: 1514<br />DescriptionTwo positive integers are said to be relatively prime to each other if the Great Common Divisor (GCD) is 1. For instance, 1, 3, 5, 7, 9...are all relati

2010-09-27 12:53:00 571

原创 hdu 1097 A hard puzzle 求a^b的个位数 二分b

A hard puzzle<br />Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 10738    Accepted Submission(s): 3691<br /><br />Problem Descriptionlcy gives a hard puzzle to feng5166,lwg,JGShining and Ignat

2010-09-26 23:06:00 1095

原创 1284 Primitive Roots 求原根,欧拉函数

Primitive RootsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1279 Accepted: 629DescriptionWe say that integer x, 0 Write a program which given any odd prime 3

2010-09-26 20:34:00 1211

原创 1324 Holedox Moving 贪吃蛇问题

Holedox MovingTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 7703 Accepted: 1891<br />DescriptionDuring winter, the most hungry and severe time, Holedox sleeps in its lair. When spring comes, Holedox wakes up, moves to the exit of its lair, come

2010-09-26 20:03:00 577 1

原创 tyvj 1047 乘积最大 N个数,K个乘号使得乘积最大

From Admin☆乘积最大       背景 Background  NOIP 2000 普及组 第三道

2010-09-24 21:43:00 1601 1

原创 tyvj 1080 N皇后 N*N的棋盘上有多少中方法使得得每行、每列只有一个、每条对角线上至多有一个棋子 二进制加速

 From睡着的树☆N皇后        描述 Description    检查一个如下的6 x 6的跳棋棋盘,有六个棋子被放置在棋盘上,使得每行、每列只有一个,每条对角线(包括两条主对角线的所有平行线)上至多有一个棋子。 <br /><br />     列号<br />  1  2  3  4  5  6 <br /><br /> ------------------------- <br /><br />1 |  | O |  |  |  |  | <br /><br /> ------------

2010-09-24 21:28:00 3135 1

原创 tyvj 1063 数字串

    Fromxjx8599☆数字串        描述 Description    给你一个长度为n的数字串,数字串里会包含1-m这些数字。如果连续的一段数字子串包含了1-m这些数字,则称这个数字字串为NUM串。你的任务是求出长度最短的NUM串是什么,只需要输出这个长度即可。<br />1<=n,m<=200000       输入格式 Input Format   第一行给定n和m。 <br />第二行n个数,表示数字串,数字间用空格隔开。<br />       输出格式 Output Forma

2010-09-24 15:29:00 965

原创 tyvj 1045 最大的算式 在n个数字中加k个乘号和n-k-1个加号,使最后结果最大

<br /> Fromsilence☆最大的算式        输入格式 Input Format   输入文件共有二行,第一行为两个有空格隔开的整数,表示N和K,其中(2<=N<=15, 0<=K<=N-1)。第二行为 N个用空格隔开的数字(每个数字在0到9之间)。        输出格式 Output Format   输出文件仅一行包含一个整数,表示要求的最大的结果<br />最后的结果<=maxlongint       样例输入 Sample Input    5 21 2 3

2010-09-24 11:23:00 2854

原创 tyvj 1289 k类每类无限个,共取n个的组合公式为C(k+n-1,n)

 Fromlwz_th☆中秋节的骰子        背景 Background    中秋节,也是lina的生日,飘飘乎居士自然要在博饼上大显身手了!!        描述 Description      所谓博饼,简单的说就是玩骰子。现在,为了庆祝lina的生日,飘飘乎居士一共准备了n个骰子,他想知道,这n个骰子在掷出去以后,一共会出现多少总情况?对于所有的骰子,没有任何的顺序可言。举个例子,假设是2个骰子,出现1 2与出现 2 1认为是相同的一种。       输入格式 Input Format  

2010-09-23 16:48:00 1315

原创 tyvj 1290 一个n位数字中出现偶数个7的个数 递推

 Fromlwz_th☆美妙的7        背景 Background     9月23日,飘飘乎居士的生日!!!        描述 Description      pink和lina来到了飘飘乎居士的家中,发现满地都是写满7的稿子......<br />  pink:“天啊,飘飘乎居士,你是想造反啊…………”<br />  lina:“你从天上飘着飘着就掉下来了啊...”<br />  飘飘乎居士:“- -! 我对7的喜爱你们又不是不知道,我只是在数一个n位数字中出现偶数个7(规定没有7记为0个,

2010-09-23 16:30:00 1011

原创 tyvj 1043 计算表达式4 +-*/^() 负号

 FromAdmin☆表达式计算4        描述 Description    给出一个表达式,其中运算符仅包含+,-,*,/,^要求求出表达式的最终值<br /><br />数据可能会出现括号情况 还有可能出现多余括号情况<br /><br />数据保证不会出现>maxlongint的数据<br /><br />数据可能回出现负数情况<br />       输入格式 Input Format   仅一行,即为表达式<br />       输出格式 Output Format   仅一行,既为表达

2010-09-23 11:50:00 681

原创 1686 Lazy Math Instructor 计算表达式 后缀表达式 +-*/^()

Lazy Math InstructorTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2087 Accepted: 712<br />DescriptionA math instructor is too lazy to grade a question in the exam papers in which students are supposed to produce a complicated formula for the qu

2010-09-23 10:28:00 514

原创 成都网络赛 B-number 求1-n中 包含13并且是13倍数的数字的个数 打表

B-number<br />Time Limit: 1000 MS Memory Limit: 262144 KDescription<br />A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub-string "13" and can be divided by 13. For example, 130 and 2613 are wqb-numbers, but

2010-09-23 10:03:00 2474

原创 hdu 1086 You can Solve a Geometry Problem too 线段相交 包含端点

You can Solve a Geometry Problem too<br />Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 2023    Accepted Submission(s): 940<br /><br />Problem DescriptionMany geometry(几何)problems were designe

2010-09-22 17:27:00 540

原创 hdu 1907 John Nim博弈 最后一个取石子者输

JohnTime Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 553    Accepted Submission(s): 275Problem DescriptionLittle John is playing very funny game with his younger brother. There is one big box filled wi

2010-09-22 16:47:00 1006

原创 hdu 2509 Be the Winner nim博弈变形 最后一个取石子者输

Be the WinnerTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 323    Accepted Submission(s): 142Problem DescriptionLet's consider m apples divided into n groups. Each group contains no more than 100 ap

2010-09-22 16:43:00 1556

原创 2661 Factstone Benchmark 求m! < 2^n, n是已知, 求满足该式最大的m

Factstone BenchmarkTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2323 Accepted: 1251<br />DescriptionAmtel has announced that it will release a 128-bit computer chip by 2010, a 256-bit computer by 2020, and so on, continuing its strategy of dou

2010-09-22 15:55:00 476

原创 hdu 2487 Ugly Windows 模拟题

Ugly Windows<br />Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)<br />Total Submission(s): 286    Accepted Submission(s): 113<br /><br />Problem DescriptionSheryl works for a software company in the country of Brada. He

2010-09-22 15:36:00 837

原创 hdu Priest John's Busiest Day 活动安排问题变形 只取一半时间

Priest John's Busiest DayTime Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 350    Accepted Submission(s): 79Problem DescriptionJohn is the only priest in his town. October 26th is the John's busiest day

2010-09-22 11:01:00 916

原创 hdu 3650 Hot Expo 活动安排 共多少天能参观完

Hot ExpoTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionSunny wants to go to the Shanghai Expo this month and he intends to visit n (1

2010-09-22 09:07:00 685

原创 hdu Treasure Hunting 求最少的X使得X!%m=0

Treasure Hunting<br />Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)<br /><br />Problem DescriptionZstu_yhr is a very curious person who fell in love with math when he was in elementary school phase. When he entered the

2010-09-22 09:06:00 708

原创 表达式计算3 +-*/^() 数据没有负数 后缀表达式

 FromAdmin☆表达式计算3        描述 Description    给出一个表达式,其中运算符仅包含+,-,*,/,^要求求出表达式的最终值在这里,"/"为整除最终结果为正整数,数据保证不需要使用高精度!       输入格式 Input Format   仅一行,即为表达式       输出格式 Output Format   仅一行,既为表达式算出的结果 结果小于maxlongint,且整个计算的过程中,也不会超过maxlongint       样例输入 Sample Input  

2010-09-19 21:30:00 1420

原创 tyvj 1042 表达式计算3 +-*/^

 FromAdmin☆表达式计算3        描述 Description    给出一个表达式,其中运算符仅包含+,-,*,/,^要求求出表达式的最终值<br /><br />在这里,"/"为整除<br /><br />最终结果为正整数,数据保证不需要使用高精度!<br /><br />       输入格式 Input Format   仅一行,即为表达式<br />       输出格式 Output Format   仅一行,既为表达式算出的结果       样例输入 Sample Input

2010-09-19 11:44:00 1429

原创 2155 Matrix 二维线段树 将一段区间取反,问某一位置的值

MatrixTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 7710 Accepted: 2891<br />DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 <= i, j

2010-09-17 20:17:00 473

原创 1410 Intersection 判断线段和矩形是否相交 转换为判断和矩形四条边是否相交以及线段是否在矩形内部 包含端点

IntersectionTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 5184 Accepted: 1284DescriptionYou are to write a program that has to decide whether a given line segment intersects a given rectangle. An example: line: start point: (4,9) end point: (11

2010-09-15 22:05:00 781

自己的ACM题库和模板

自己的ACM题库和模板

2012-02-04

java聊天室

java聊天室

2011-12-29

dancing links

DLX dancinglinks 跳舞链

2011-12-29

acm动态规划总结

Pku acm 1163 the Triangle 动态规划题目总结(一) 题目:http://acm.pku.edu.cn/JudgeOnline/problem?id=1163 对于一个有数字组成的二叉树,求由叶子到根的一条路径,使数字和最大,如: 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 这个是经典的动态规划,也是最最基础、最最简单的动态规划,典型的多段图。思路就是建立一个数组,由下向上动态规划,保存页子节点到当前节点的最大值,Java核心代码如下: for(int i=num-2;i>

2011-12-29

拓展 KMP edtend MP

给定一个串S,定义n=|S|,extend[i]表示S与S[i…n]的最长公共前缀长度。我们可以在线性时间内得到所有的extend[i]。 鉴于已有论文对这个算法进行细致、感性的描述,在此就不花费篇幅赘述这一算法。如果您想详细了解这一算法,可以参见《寻找最大重复子串》(作者林希德)和《求最长回文子串与最长重复子串》(作者何林)。

2011-04-14

joj 部分题目答案 自己做的 仅供参考

joj 部分题目答案 自己做的 仅供参考 joj 部分题目答案 自己做的 仅供参考 joj 部分题目答案 自己做的 仅供参考 joj 部分题目答案 自己做的 仅供参考 joj 部分题目答案 自己做的 仅供参考

2010-07-10

递推求解 集合了递推的一些题目

在一个平面上有一个圆和n条直线,这些直线中每一条在圆内同其他直线相交,假设没有3条直线相交于一点,试问这些直线将圆分成多少区域。

2010-07-10

空空如也

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

TA关注的人

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