数学+DP
Modiz
这个作者很懒,什么都没留下…
展开
-
Cheerleaders(容斥定理)
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=23942#problem/C题意:在一个m行n列的矩阵里站k个拉拉队员,问有多少种方法,四周边界必须有一个队员....这里用到组合数加容斥定理,将重复的删除,第一行,最后一行,第一列,最后一列....用到位运算来模拟16种情况..这里要吐槽一下,中英文输入法,和cas原创 2013-05-16 20:27:31 · 870 阅读 · 0 评论 -
Triangle Counting(n范围内能组成多少个三角形)
题意:有边长1--n的棍各一个,能组成多少个三角形...题目链接:http://openoj.awaysoft.com:8080/judge/contest/view.action?cid=423#problem/B自己找规律吧,每增加边长为n的棍,是f[n-1]+多少个三角形。#include long long f[1000010],s;int main(){ int i,原创 2013-05-09 21:13:19 · 925 阅读 · 0 评论 -
Chess Queen(数学推断题)
题意:有两个棋子,在同一行或者同一列或同一斜行中可以相互吃掉...然后给出棋盘大小,问有多少种情况...解题思路:自己画图吧,先把横纵的算出来,在看斜行的规律...注意的是数据范围太大,必须lld,而且不知道为什么,我找到一个规律就是所有把变量加入乘法运算的都得用lld,不然只有wrong了...Output: Standard Output You probably know原创 2013-05-13 18:48:45 · 835 阅读 · 0 评论 -
五边形数定理(转自维基百科)
题目来源于杭电第五场多校联合:给出一个n,求出1-n个数,组合加起来等于n的方式有多少种,顺序不一样算同一种...五边形数定理是一个由欧拉发现的数学定理,描述欧拉函数展开式的特性[1][2]。欧拉函数的展开式如下:亦即欧拉函数展开后,有些次方项被消去,只留下次方项为1, 2, 5, 7, 12, ...的项次,留下来的次方恰为广义五边形数。若将上式视为幂级数,其收敛半径转载 2013-08-07 10:04:55 · 1541 阅读 · 0 评论 -
LCIS最长上升公共子序列(HDU 1423)
题意:给出两组数列,求其最长上升公共子序列的个数;还是不会说...自己看...#include #include #include #include #include #include using namespace std;int n,m,a[510],b[510],f[510];int LCIS(){ int i,j,k; memset(f,0,sizeof(f)原创 2013-10-01 11:04:46 · 773 阅读 · 0 评论 -
UVA 10209 Is This Integration ?
Problem CIs This Integration ?Input: Standard InputOutput: Standard OutputTime Limit: 3 seconds In the image below you can see a square ABCD, where AB = BC = CD = DA = a. Four arcs a原创 2013-11-20 19:05:47 · 1022 阅读 · 0 评论 -
(code jam)Problem B. Cookie Clicker Alpha
IntroductionCookie Clicker is a Javascript game by Orteil, where players click on a picture of a giant cookie. Clicking on the giant cookie gives them cookies. They can spend those cookies to buy原创 2014-04-15 18:28:53 · 703 阅读 · 0 评论 -
二进制位运算模拟所有情况。
给出一个N,就有2^N种不同的原创 2014-05-08 09:49:12 · 734 阅读 · 0 评论 -
POJ1006: 中国剩余定理的完美演绎
原文转自:http://www.cnblogs.com/walker01/archive/2010/01/23/1654880.html问题描述 人自出生起就有体力,情感和智力三个生理周期,分别为23,28和33天。一个周期内有一天为峰值,在这一天,人在对应的方面(体力,情感或智力)表现最好。通常这三个周期的峰值不会是同一天。现在给出三个日期,分别对应于体力,情感,智力出现峰值的日转载 2013-11-11 18:22:46 · 1586 阅读 · 1 评论 -
(code jam)Problem C. Numbers
ProblemIn this problem, you have to find the last three digits before the decimal point for the number (3 + √5)n.For example, when n = 5, (3 + √5)5 = 3935.73982... The answer is 935.For n = 2, (原创 2014-04-08 22:04:15 · 953 阅读 · 0 评论 -
欧拉函数的递推形式
View Code 1 #include 2 int main() 3 { 4 int n; 5 scanf("%d",&n); 6 int* a=new int[n+1]; 7 for (int i = 1; i 8 for (int i = 2; i 2) a[i] /= 2; 9 for (int i = 3; i 2) 10 if(a[i] == i) 11 {12 for (int原创 2013-07-29 14:40:32 · 1453 阅读 · 0 评论 -
Problem A: Advanced Mathematics
Problem A: Advanced MathematicsTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 28 Solved: 17[Submit][Status][Web Board]DescriptionAlice, your goddess, is going out with Bob, her boyf原创 2014-04-28 19:42:45 · 769 阅读 · 0 评论 -
小手一打就是标准的博弈论。
1.巴什博奕:一堆石子轮流取,最多只能取m个,原创 2014-07-15 10:33:09 · 622 阅读 · 0 评论 -
HDU1536 SG博弈+尼姆博弈
S-NimTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4289 Accepted Submission(s): 1857Problem DescriptionArthur and his siste原创 2014-07-15 19:16:07 · 596 阅读 · 0 评论 -
Codeforces Round #256 (Div. 2) E. Divisors
E. Divisorstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBizon the Champion isn't just friendly, he also原创 2014-07-18 23:37:43 · 844 阅读 · 0 评论 -
湖大暑假训练赛2:The Stones Game
The Stones GameTime Limit: 10000ms, Special Time Limit:25000ms, Memory Limit:65536KBTotal submit users: 28, Accepted users: 26Problem 12828 : No special judgementProblem descri原创 2014-07-21 00:17:28 · 1255 阅读 · 0 评论 -
湖大训练赛1 Broken Audio Signal
Broken Audio SignalTime Limit: 20000ms, Special Time Limit:50000ms, Memory Limit:65536KBTotal submit users: 66, Accepted users: 40Problem 12812 : No special judgementProblem de原创 2014-07-21 08:05:37 · 754 阅读 · 0 评论 -
湖大训练赛1 Restore Calculation
Restore CalculationTime Limit: 20000ms, Special Time Limit:50000ms, Memory Limit:65536KBTotal submit users: 20, Accepted users: 17Problem 12813 : No special judgementProblem de原创 2014-07-21 19:01:31 · 683 阅读 · 0 评论 -
Hdu 1517 博弈论
A Multiplication GameTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3625 Accepted Submission(s): 2057Problem DescriptionStan原创 2014-07-22 10:59:58 · 668 阅读 · 0 评论 -
HDU 4857 逃生。
逃生Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 582 Accepted Submission(s): 156Problem Description糟糕的事情发生啦,现在大家都忙着逃命。但是逃命的通原创 2014-07-22 10:05:54 · 845 阅读 · 0 评论 -
湖大训练赛2 Modified LCS
解这道题目之前,我们先来回顾一下我们的老题:青蛙的约会。原创 2014-07-21 22:32:37 · 934 阅读 · 0 评论 -
Frist Blood poj3254(状态压缩+DP)
Corn FieldsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 7049 Accepted: 3749DescriptionFarmer John has purchased a lush new rectangular pasture compos原创 2014-07-23 22:05:45 · 636 阅读 · 0 评论 -
欧几里得定理与扩展欧几里得
3,欧几里德定理:(射影定理)定理指出素数是无限的。a*b*c+1要么是素数要么其质因子就是素数。原创 2014-04-09 21:46:46 · 1005 阅读 · 0 评论 -
STL next_premutation函数的C++和C的作用。
众所周知有很多情况是求一个序列的所有排列。原创 2014-07-24 16:19:52 · 2727 阅读 · 0 评论 -
多校训练赛2 ZCC loves cards
ZCC loves cardsTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 260 Accepted Submission(s): 7Problem Description ZCC loves p原创 2014-07-24 16:11:28 · 1181 阅读 · 3 评论 -
二分法求速度。
DrivingSpecial JudgeTime Limit: 20000/10000MS (Java/Others)Memory Limit: 512000/256000KB (Java/Others)SubmitStatisticNext ProblemProblem DescriptionJohn需要开车从A地到B地去和他的girlfriend去约会。原创 2014-07-07 21:55:02 · 1294 阅读 · 2 评论 -
大数同余定理
(a+b)%c=(a%c+b%c)%c#include #include #include #include using namespace std;char a[1000];int n,i;int main(){ while (~scanf("%s%d",a,&n)) { int m=0; int l=strlen(a); for (i=0;i<l;i++)原创 2014-07-08 20:11:33 · 1723 阅读 · 0 评论 -
poj1704 Georgia and Bob(阶梯博弈)
Georgia and BobTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 7457 Accepted: 2254DescriptionGeorgia and Bob decide to play a self-invented game. They原创 2014-07-17 09:57:10 · 784 阅读 · 1 评论 -
连分数逼近。
首先,我们得知道...什么是连分数:原创 2014-07-09 09:42:10 · 2187 阅读 · 0 评论 -
Hdu1404 Digital Deletions(暴力SG博弈)
Digital DeletionsTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1902 Accepted Submission(s): 682Problem DescriptionDigital d原创 2014-08-01 20:30:21 · 1913 阅读 · 1 评论 -
TC。求一个大数的最大因子满足完全平方数。
#include #include #include #include #include #include #include #include #include #include #include using namespace std;#define LL long longclass SquareDivisor{ public: long long bigge原创 2014-07-29 10:55:00 · 1072 阅读 · 0 评论 -
素数筛选法。
#include #include #include #include #define max 100000using namespace std;int main(){ int a[max+10],p[max+10]; int i,j,k=0,n; memset(a,0,sizeof(a)); memset(p,0,sizeof(p)); for (i=2;i<=max;原创 2014-07-04 17:29:17 · 749 阅读 · 0 评论 -
Codeforeces 453A Little Pony and Expected Maximum
A. Little Pony and Expected Maximumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTwilight Sparkle was pla原创 2014-08-03 16:45:06 · 820 阅读 · 0 评论 -
HDU1527(威佐夫博奕)+Hdu 2177
取石子游戏Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3566 Accepted Submission(s): 1792Problem Description有两堆石子,数量任意,可以不同。游戏开始原创 2014-08-03 19:36:25 · 700 阅读 · 0 评论 -
HDU1851(sg博弈+nim博弈)
A Simple GameTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/65535 K (Java/Others)Total Submission(s): 1107 Accepted Submission(s): 689Problem DescriptionAgrael likes原创 2014-08-04 17:00:56 · 533 阅读 · 0 评论 -
Hdu2999 sg函数构造
Stone Game, Why are you always there?Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 455 Accepted Submission(s): 154Problem Descr原创 2014-08-05 10:19:55 · 867 阅读 · 0 评论 -
poj1185 炮兵阵地(状态压缩+DP)
炮兵阵地Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 18629 Accepted: 7179Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也原创 2014-07-29 20:48:44 · 609 阅读 · 0 评论 -
poj 3311Hie with the Pie(解题的两种方法)状态压缩dp,或全排列。
Hie with the PieTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3994 Accepted: 2118DescriptionThe Pizazz Pizzeria prides itself in delivering pizzas to原创 2014-07-30 08:35:05 · 811 阅读 · 0 评论 -
Apple。好题!ACdream群赛
题目链接:http://acdream.info/problem?pid=1131题意原创 2014-07-12 10:41:35 · 709 阅读 · 0 评论 -
hdu3001 三进制状态压缩+dp
TravellingTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3477 Accepted Submission(s): 1084Problem DescriptionAfter coding so原创 2014-07-30 11:05:42 · 789 阅读 · 0 评论