随笔分类 -  数学,二分,素数

摘要:0:Enclosurehttp://poj.openjudge.cn/challenge3/0/查看提交统计提问总时间限制:1000ms内存限制:131072kB描述为了防止爆零而加入了一道热身题。大家轻虐~Picks在参加NOI(网上同步赛)时,看到大家都在疯狂讨论“圈地游戏”,于是Picks对这个游戏很!好!奇!他想自己开发一个Bot来玩。不过Picks水平不行……写一个复杂的程序对他太难了,于是他简化了一下,使得场上只有他写的Bot,且场地大小无限。圈地游戏的规则是:Bot能够水平或者纵向移动 1 格,每次移动可以选择是否落笔,在落笔状态下就会画出轨迹。每当曾经自己走到的轨迹上时,围成的 阅读全文
posted @ 2013-10-13 19:56 Jack Ge 阅读(521) 评论(0) 推荐(0) 编辑
摘要:Cut PiecesTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 762Accepted Submission(s): 317Problem DescriptionSuppose we have a sequence of n blocks. Then we paint the blocks. Each block should be painted a single color and block i can have color 1 t 阅读全文
posted @ 2013-08-12 09:29 Jack Ge 阅读(265) 评论(0) 推荐(0) 编辑
摘要:HeheTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 355Accepted Submission(s): 202Problem DescriptionAs we all know, Fat Brother likes MeiZi every much, he always find some topic to talk with her. But as Fat Brother is so low profile that no one kn 阅读全文
posted @ 2013-08-01 23:44 Jack Ge 阅读(426) 评论(0) 推荐(0) 编辑
摘要:[1475] Bachelor http://acm.nbut.cn:8081/Problem/view.xhtml?id=1475时间限制: 1000 ms 内存限制: 65535 K问题描述炎热的暑期集训就要结束了,在这短短的20天,大家都很努力,因为很多都是光棍嘛。balabala所以 Marknoon 先森一直耿耿于怀,毕竟他也是单身嘛。有一天,Marknoon 先森看着一串数字,发现了那个跟他同命相连的数字1,所以他就开始无聊起来,想知道从数字1到数字N,一共出现了几个1。例如N=12,则1的个数为5,出现1的数字分别为1,10,11,12。输入输入一个数N(1... 阅读全文
posted @ 2013-07-25 07:31 Jack Ge 阅读(319) 评论(0) 推荐(0) 编辑
摘要:Dropping testsTime Limit:1000MSMemory Limit:65536KTotal Submissions:4654Accepted:1587DescriptionIn a certain course, you takentests. If you getaiout ofbiquestions correct on testi, your cumulative average is defined to be.Given your test scores and a positive integerk, determine how high you can mak 阅读全文
posted @ 2013-07-08 10:12 Jack Ge 阅读(865) 评论(0) 推荐(0) 编辑
摘要:Train Problem IITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4358Accepted Submission(s): 2391Problem DescriptionAs we all know the Train Problem I, the boss of the Ignatius Train Station want to know if all the trains come in strict-increasing o 阅读全文
posted @ 2013-07-03 22:44 Jack Ge 阅读(867) 评论(0) 推荐(0) 编辑
摘要:小兔的棋盘Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4665Accepted Submission(s): 2586Problem Description小兔的叔叔从外面旅游回来给她带来了一个礼物,小兔高兴地跑回自己的房间,拆开一看是一个棋盘,小兔有所失望。不过没过几天发现了棋盘的好玩之处。从起点(0,0)走到终点(n,n)的最短路径数是C(2n,n),现在小兔又想如果不穿越对角线(但可接触对角线上的格点),这样的路径数有多少?小兔想了很 阅读全文
posted @ 2013-07-03 22:28 Jack Ge 阅读(586) 评论(0) 推荐(0) 编辑
摘要:Light BulbTime Limit:1 Second Memory Limit:32768 KBCompared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow and he has only one light bulb in his house. Every night, he is wandering in his incommodious house, thinking of how to earn more money. One day, 阅读全文
posted @ 2013-07-03 11:51 Jack Ge 阅读(658) 评论(0) 推荐(0) 编辑
摘要:HOJ1402 整数划分http://acm.hit.edu.cn/hoj/problem/view?id=1402【题目描述】整数划分是一个经典的问题。希望这道题会对你的组合数学的解题能力有所帮助。Input每组输入是两个整数n和k。(1 #include#includeusing namespace std;const int maxn = 51;int n,k;int f[maxn][maxn], g[maxn][maxn];int f1[maxn][maxn], f2[maxn][maxn];int main () { int i, j; int ans1, ans2, a... 阅读全文
posted @ 2013-06-30 20:52 Jack Ge 阅读(1193) 评论(0) 推荐(0) 编辑
摘要:The number of stepsTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述 Mary stands in a strange maze, the maze looks like a triangle(the first layer have one room,the second layer have two rooms,the third layer have three rooms …). Now she stands at the top point(the first layer), and the KEY of . 阅读全文
posted @ 2013-06-21 10:37 Jack Ge 阅读(685) 评论(0) 推荐(0) 编辑
摘要:Alice and BobTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述 Alice and Bob like playing games very much.Today, they introduce a new game. There is apolynomial like this:(a0*x^(2^0)+1) * (a1* x^(2^1)+1)*.......*(an-1* x^(2^(n-1))+1). Then Alice ask Bob Q questions. In theexpansion of the Poly.. 阅读全文
posted @ 2013-06-21 09:56 Jack Ge 阅读(294) 评论(0) 推荐(0) 编辑
摘要:A Simple Math ProblemTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1697Accepted Submission(s): 959Problem DescriptionLele now is thinking about a simple function f(x).If x < 10 f(x) = x.If x >= 10 f(x) = a0 * f(x-1) + a1 * f(x-2) + a2 * f(x 阅读全文
posted @ 2013-06-20 14:28 Jack Ge 阅读(1872) 评论(0) 推荐(0) 编辑
摘要:A Multiplication GameTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2674Accepted Submission(s): 1532Problem DescriptionStan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Stan always starts with 阅读全文
posted @ 2013-06-20 13:38 Jack Ge 阅读(501) 评论(0) 推荐(0) 编辑
摘要:Rescue The PrincessTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述 Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immediately. Yet, the beast set a maze. Only if the prince find 阅读全文
posted @ 2013-06-18 16:22 Jack Ge 阅读(440) 评论(0) 推荐(0) 编辑
摘要:Binary TreeTime Limit:1000MSMemory Limit:65536KTotal Submissions:5399Accepted:2502DescriptionBackgroundBinary trees are a common data structure in computer science. In this problem we will look at an infinite binary tree where the nodes contain a pair of integers. The tree is constructed like this:T 阅读全文
posted @ 2013-06-16 18:43 Jack Ge 阅读(301) 评论(0) 推荐(0) 编辑
摘要:Dirichlet's Theorem on Arithmetic ProgressionsTime Limit:1000MSMemory Limit:65536KTotal Submissions:13636Accepted:6808DescriptionIfaanddare relatively prime positive integers, the arithmetic sequence beginning withaand increasing byd, i.e.,a,a+d,a+ 2d,a+ 3d,a+ 4d, ..., contains infinitely many p 阅读全文
posted @ 2013-06-16 16:55 Jack Ge 阅读(376) 评论(0) 推荐(0) 编辑
摘要:YY's new problemTime Limit: 12000/4000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3158Accepted Submission(s): 890Problem DescriptionGiven a permutation P of 1 to N, YY wants to know whether there exists such three elements P[i1], P[i2], P[i3] thatP[i1]-P[i2]=P[ 阅读全文
posted @ 2013-05-23 12:57 Jack Ge 阅读(270) 评论(0) 推荐(0) 编辑
摘要:测试你是否和LTC水平一样高Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10092Accepted Submission(s): 3254Problem Description大家提到LTC都佩服的不行,不过,如果竞赛只有这一个题目,我敢保证你和他绝对在一个水平线上!你的任务是:计算方程x^2+y^2+z^2= num的一个正整数解。Input输入数据包含多个测试实例,每个实例占一行,仅仅包含一个小于等于10000的正整数num。Outpu 阅读全文
posted @ 2013-05-23 12:38 Jack Ge 阅读(273) 评论(0) 推荐(0) 编辑
摘要:SORT AGAINTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3092Accepted Submission(s): 987Problem Description给你N个整数,x1,x2...xn,任取两个整数组合得到|xi-xj|,(0<i,j<=N,i!=j)。现在请你计算第K大的组合数是哪个(一个组合数为第K大是指有K-1个不同的组合数小于它)。Input输入数据首先包含一个正整数C,表示包含C组测试用例.每组测试数据的 阅读全文
posted @ 2013-05-23 12:25 Jack Ge 阅读(323) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn=50;int equ,var; //行数,列数int a[maxn][maxn]; //增广矩阵int x[maxn]; //解集bool free_x[maxn]; //标记是否是不确定的变元void Debug(){ int i,j; for(i=0;i<equ;i++){ for(j=0;j<var+1;j++) pr.. 阅读全文
posted @ 2013-05-23 07:28 Jack Ge 阅读(588) 评论(0) 推荐(0) 编辑