acm
文章平均质量分 77
acm比赛题目
「已注销」
这个作者很懒,什么都没留下…
展开
-
poj 3320 尺取法 + map + set
Jessica's Reading ProblemTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13290 Accepted: 4580DescriptionJessica's a very lovely girl wooed by lots of原创 2017-08-20 10:33:27 · 292 阅读 · 0 评论 -
poj 2342 树形dp入门
Anniversary partyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8203 Accepted: 4698DescriptionThere is going to be a party to celebrate the 80-th Anniv原创 2017-04-17 21:59:33 · 399 阅读 · 0 评论 -
poj 1849 树形dp
TwoTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1473 Accepted: 748DescriptionThe city consists of intersections and streets that connect them.Hea原创 2017-04-18 15:08:10 · 379 阅读 · 0 评论 -
poj 2486 树形dp
Apple TreeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10506 Accepted: 3507DescriptionWshxzt is a lovely girl. She likes apple very much. One day HX原创 2017-04-18 17:04:31 · 355 阅读 · 0 评论 -
poj 2443 状态压缩 叉姐的魔法训练
Set OperationTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 3162 Accepted: 1284DescriptionYou are given N sets, the i-th set (represent by S(i)) have C原创 2017-01-02 23:10:20 · 482 阅读 · 0 评论 -
poj 3244 公式推导 叉姐的魔法训练
Difference between TripletsTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 2723 Accepted: 919DescriptionFor every pair of triplets, Ta = (Ia, Ja, Ka原创 2017-04-17 21:01:28 · 912 阅读 · 0 评论 -
poj 3213 叉姐的魔法训练
PM3Time Limit: 5000MS Memory Limit: 131072KTotal Submissions: 3400 Accepted: 1193DescriptionUSTC has recently developed the Parallel Matrix Multiplication Machi原创 2017-04-18 20:25:14 · 696 阅读 · 0 评论 -
L - Mahdi And The Teddy Bear 字符串模拟
L. Mahdi And The Teddy Beartime limit per test8 secondsmemory limit per test256 megabytesinputmahdi.inoutputstandard outputTime goes so quickly; remember Bakkar’s &Maym转载 2017-04-14 09:36:06 · 632 阅读 · 0 评论 -
51nod 1116 K进制下的大数
1116 K进制下的大数基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题 收藏 关注有一个字符串S,记录了一个大数,但不知这个大数是多少进制的,只知道这个数在K进制下是K - 1的倍数。现在由你来求出这个最小的进制K。例如:给出的数是A1A,有A则最少也是11进制,然后发现A1A在22进制下等于4872,4872 mod原创 2017-03-05 22:52:44 · 325 阅读 · 0 评论 -
51nod 1105 二分套二分
题意:中文题题解:思路:二分套二分步骤:1···对两个数组进行排序2···找到二分答案所需的上下界进行二分(mid)3···然后枚举一个数组下标,对另外一个数组下标进行二分4···第三步用函数计算比mid大的数有多少个这样二分下来即可以得到所需要第K大的数#include#include#includeusing namespace std原创 2017-04-12 20:33:34 · 371 阅读 · 0 评论 -
51nod 1686 二分+尺取法
题意:给出数组,区间的值为其重数(这个重数是指区间内的重数,不是整个数组的重数),求解第K大小的区间值(重数)题解:思路:二分+尺取法由上知:重数的范围为 1~~100000重数值大的区间一定包括重数值小的区间因此找到有大于等于K个区间值为mid就是答案了注意:有可能第K大的值和第K-1个 或者 第 k-2个值相等例如:数组 1 2原创 2017-04-12 22:08:01 · 450 阅读 · 0 评论 -
hihocoder 第139周
#1272 : 买零食时间限制:5000ms单点时限:1000ms内存限制:256MB描述小Ho很喜欢在课间去小卖部买零食。然而不幸的是,这个学期他又有在一教的课,而一教的小卖部姐姐以冷若冰霜著称。第一次去一教小卖部买零食的时候,小Ho由于不懂事买了好一大堆东西,被小卖部姐姐给了一个“冷若冰霜”的眼神,食欲都下降了很多。从那以后,小Ho就原创 2017-03-05 17:58:56 · 445 阅读 · 0 评论 -
hiho 175 周 贪心 (北美startup的面试题)
#1340 : Robots Crossing River时间限制:10000ms单点时限:1000ms内存限制:256MB描述Three kinds of robots want to move from Location A to Location B and then from Location B to Location C by b原创 2017-11-13 22:37:27 · 300 阅读 · 0 评论 -
La Salle-Pui Ching Programming Challenge 2017 Gym - 101522A,B,C,D,H,I,K
A题:计算模糊日期的天数,简单思维题,注意long long#include#include#includeusing namespace std;#define LL long longint a[100005];int main(){ int n; //freopen("in.txt","r",stdin); while(scanf("%d",原创 2017-12-21 20:25:48 · 785 阅读 · 0 评论 -
中南林业科技大学第十一届程序设计大赛校赛题解
A-译码B-Fence RepairC-有趣的二进制D-有趣的数字E-邝博士的问题F-新田忌赛马G-组合游戏A-译码Problem Description: 现在定义一种编码规则:对于长度为3的字符串(均由小写字母组成),首先按照字典序进行排序,即aaa,aab,aac,…,zzz,将这些字符串按照顺序依次从00001至17575编码(前缀0不可...原创 2018-05-21 02:31:17 · 1421 阅读 · 2 评论 -
csu 1803 16年湖南省赛
1803: 2016Time Limit: 5 Sec Memory Limit: 128 MBSubmit: 628 Solved: 413[Submit][Status][Web Board]Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量:1. 1≤a≤n,1≤b≤m;2. a×b 是 2016 的原创 2016-11-28 19:29:52 · 468 阅读 · 0 评论 -
2016湘潭邀请赛 xtu1245
Hamiltonian PathIn ICPCCamp, there are n cities and m directed roads between cities. The i-th road going from the ai-th city to the bi-th city is ci kilometers long. For each pair of原创 2017-03-02 19:43:12 · 768 阅读 · 0 评论 -
2016湘潭邀请赛 xtu1250
Super Fast Fourier Transform Accepted : 67 Submit : 354Time Limit : 2000 MS Memory Limit : 65536 KBSuper Fast Fourier TransformBobo has two sequences of int原创 2017-03-02 22:23:38 · 462 阅读 · 0 评论 -
2016年湘潭邀请赛 xtu1249
Rolling Variance Accepted : 73 Submit : 205Time Limit : 3000 MS Memory Limit : 65536 KB Special JudgeRolling VarianceBobo learnt that the variance of a sequ原创 2017-03-02 23:05:04 · 717 阅读 · 0 评论 -
2016年湘潭邀请赛 xtu1252
Defense Tower Accepted : 92 Submit : 176Time Limit : 3000 MS Memory Limit : 65536 KBDefense TowerIn ICPCCamp, there are n cities and (n−1) (bidirectiona原创 2017-03-03 00:16:13 · 546 阅读 · 0 评论 -
poj1256 tolower函数
这里我使用库函数进行全排但是在字符或者字符串的排列需要先进行排序的当需要注意A a的排序问题了,这里还使用了tolower这个函数的#include#include#includeusing namespace std;bool cmp(char p,char k){ char a=tolower(p); char b=tolower(k);原创 2016-03-20 16:50:16 · 412 阅读 · 0 评论 -
2015年沈阳区域赛-重现赛hdu 5512 gcd 博弈
PagodasTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1333 Accepted Submission(s): 935Problem Descriptionn pagodas were standi原创 2016-11-20 21:02:00 · 373 阅读 · 0 评论 -
Problem H. Game with the Stones 博弈论
题意:之前理解错了题意了,没有看清楚是将所有的石子都分一遍(这样的话就只用考虑最大堆即可)两个人轮流分石子,Constantine这个人先手每次将每一堆石子分为两堆,如果这一堆只有一个石子就不用分了最后一个人没有办法再分堆的时候就输了题解:草稿纸上递推模拟:1 败2 胜(因为2分解得到1+1导致另外一个人败)3 败(因为3分解得原创 2017-04-14 11:42:13 · 702 阅读 · 5 评论 -
bash博弈变体
解法一:bash博弈变体:双方博弈的时候都尽量不会让对方到达必胜状态所以对于第一堆,你取 x ,他就会取 c-x+1 保证总和为 c+1 ,为一个偶状态(取了两次)所以最后就剩下 a%( c+1 ) 和 b%(d+1) ,若两者相等就输了,不等就赢了例如:剩下(2 , 2) 你取 1 ,他也取 1 ,或者你取 2 ,他也取 2 ,反正你就是赢不了剩下(2 ,原创 2017-04-15 14:27:35 · 496 阅读 · 0 评论 -
nim游戏详解(易懂)
Nim游戏的概述:还记得这个游戏吗?给出n列珍珠,两人轮流取珍珠,每次在某一列中取至少1颗珍珠,但不能在两列中取。最后拿光珍珠的人输。后来,在一份资料上看到,这种游戏称为“拈(Nim)”。据说,它源自中国,经由被贩卖到美洲的奴工们外传。辛苦的工人们,在工作闲暇之余,用石头玩游戏以排遣寂寞。后来流传到高级人士,则用便士(Pennies),在酒吧柜台上玩。最有名的玩法,是把十二枚便士放转载 2017-04-15 16:57:43 · 16394 阅读 · 1 评论 -
威佐夫博弈(高精度)
威佐夫博弈详解只要形成了奇异局势,那么下个人必须;威佐夫博弈: 有两堆各若干个物品,两个人轮流从某一堆或同时从两堆中取同样多的物品,规定每次至少取一个,多者不限,最后取完者得胜。这种情况下是颇为复杂的。可以用两个数(a[k],b[k])(ps:(a[k]≤b[k])k为一个自然数)表示两堆物品的数量。如果该数量为奇异局势,那么先手输;前几个奇异局势如下:(0,0,)、(1,转载 2017-04-15 17:49:22 · 604 阅读 · 0 评论 -
bash游戏V4 斐波那契博弈
有一堆个数为n(n>=2)的石子,游戏双方轮流取石子,规则如下:1)先手不能在第一次把所有的石子取完,至少取1颗;2)之后每次可以取的石子数至少为1,至多为对手刚取的石子数的2倍。约定取走最后一个石子的人为赢家,求必败态。结论:当n为Fibonacci数的时候,必败。f[i]:1,2,3,5,8,13,21,34,55,89…… 用第二数学归纳法证明:为了方便,我们转载 2017-04-16 16:47:46 · 421 阅读 · 0 评论 -
Lightoj 1027 期望
You are in a maze; seeing n doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all doors.If you choose the ith door, it can either原创 2017-07-24 10:24:18 · 312 阅读 · 0 评论 -
lightoj 1030 lightoj 1038 基础概率dp 期望
You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold.Initially you are in position 1. Now each turn you throw a perfect原创 2017-07-24 11:31:05 · 426 阅读 · 0 评论 -
lightoj-1104 生日悖论 有意思
生日悖论,指如果一个房间里有23个或23个以上的人,那么至少有两个人的生日相同的概率要大于50%。这就意味着在一个典型的标准小学班级(30人)中,存在两人生日相同的可能性更高。对于60或者更多的人,这种概率要大于99%。从引起逻辑矛盾的角度来说生日悖论并不是一种悖论,从这个数学事实与一般直觉相抵触的意义上,它才称得上是一个悖论。大多数人会认为,23人中有2人生日相同的概率应该远远小于50%。计算与原创 2017-07-24 16:46:38 · 723 阅读 · 0 评论 -
LightOJ 1265 概率
题意:有 t只老虎,d只鹿,还有一个人,每天都要有两个生物碰面,现在有以下规则老虎不管碰到谁都吃掉,同类的话就同归于尽,其他两个生物忽略不计问人存活下来的概率题解:人生存下来的条件就是不被老虎吃掉,所以只要所有的老虎都同归于尽即可如果老虎的数量是奇数,此人会死,如果老虎的数量是偶数,那就算一下所有老虎同归于尽的概率,这个概率就是人存活下来的概率了当老虎的数量是偶原创 2017-07-24 20:31:57 · 405 阅读 · 0 评论 -
多式子递推poj2545 poj2591 poj1338
就是理解选择最小的,并且指针要移动,而是if里面是不能有else的,这样的话就可以保证相同的数字能够同时并进poj2545#include#includeusing namespace std;int main(){ long long a[100000]; long long n1,n2,n3; long long n; scanf("%lld%lld%lld%lld",原创 2016-02-01 00:11:40 · 400 阅读 · 0 评论 -
poj 1503 大整数高精度 加法
题目就是正整数相同长度相加#include#includechar last[200],now[200];void rever(char a[],int n){ for(int i=0,j=n-1;ij;i++,j--){ char ch=a[i]; a[i]=a[j]; a[j]=ch; } return ;}int main(){原创 2016-02-01 00:11:29 · 633 阅读 · 0 评论 -
poj2389 大整数乘法
#include#include#includeusing namespace std;char a[45],b[45];int ans[100]={0};int c[45]={0},d[45]={0};int main(){ scanf("%s",a); int len1=strlen(a); reverse(a,a+len1); scanf("%s",b); in原创 2016-02-01 00:11:35 · 624 阅读 · 0 评论 -
poj1001 经典大整数
#include#include#includeusing namespace std;int main(){ char a[8]; int n; int ans[200],temp[8]; int pos; //小数点之前的位数 while(scanf("%s %d",a,&n)!=EOF) { pos=-1; mem原创 2016-02-01 00:11:47 · 481 阅读 · 0 评论 -
poj 3982 大数据相加
题目意思:把输入的三个数字作为 数列前三个元素 然后计算第九十九个元素的值用java当然很快,但是为了锻炼自己的能力就用C语言写吧这里我用了滚动数组,就减少了空间的消耗量然后就是大数大基本运算了#include#include#includeusing namespace std;int a[3][150];char temp[3][10];int main(){原创 2016-02-01 13:06:19 · 492 阅读 · 0 评论 -
poj 1693 模拟
Counting RectanglesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1072 Accepted: 557DescriptionWe are given a figure consisting of only horizontal an原创 2016-07-18 15:49:13 · 473 阅读 · 0 评论 -
poj2403 模拟题目
Hay PointsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6251 Accepted: 3997DescriptionEach employee of a bureaucracy has a job description - a few p原创 2016-07-24 10:45:59 · 797 阅读 · 0 评论 -
poj1060 大数
#include#include#includeusing namespace std;const int maxx=2010;int f[maxx],g[maxx],h[maxx];int sum[maxx],p;int pf,pg,ph;void init(){ scanf("%d",&pf); for(int i=pf-1;i>=0;i-原创 2016-07-25 14:01:36 · 370 阅读 · 0 评论 -
hdu 4422 模拟
The Little Girl who Picks MushroomsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2600 Accepted Submission(s): 828Problem Descri原创 2016-08-11 10:34:53 · 409 阅读 · 0 评论