Algorithm Competition
sosidami
这个作者很懒,什么都没留下…
展开
-
POJ 1879
POJ 1879 佳佳书上的题目。首先将小球编号1,2,。。。n.然后模拟小球最先24小 时的运行情况,然后得到两个小球队列的一个置换。F(1,2..n)= (p1,p2,...pn);求出每一个小球返回原位置的周期,则总时间为所有时间的 最小公倍数。 这个问题的收获在于置换群的应用,求出群中每一个元素的周期,然后求最小公倍数原创 2009-10-26 23:12:00 · 832 阅读 · 0 评论 -
TDU 2008 Single Prime
#include #include #include #include using namespace std;const int PN = 10000000;int primes[PN];vector primelist;void sieve() { primes[0] = 0; primes[1] = 0; primes[2] = 1;原创 2009-12-17 17:11:00 · 500 阅读 · 0 评论 -
TUD 2008 Single Porking the Social
#include using namespace std;int main(){ int id[1000000], sz[1000000]; int N; cin >> N; for (int I = 1; I <= N; ++I) { int n, k; cin >> n >> k; //n个人,k个关系 for (int i = 0; i < n;原创 2009-12-17 20:27:00 · 431 阅读 · 0 评论 -
TCHS SRM 31 Problem 500
题目:Problem Statement Its only 9 AM, and already your day has been horrible. You overslept your alarm, your oatmeal got cold as you listened to the traffic report, and the wat原创 2010-02-24 22:43:00 · 720 阅读 · 0 评论 -
Codeforces Beta Round #2
转载hhang大牛的blog。。。A – Winner这个比较简单 ,Pass,简单迭代B. The least round way1000*1000的方阵,每个格子有一个非负整数,现在要从左上走到右下,每次只能向下或者向右走。目标是使得所有走的格子里的数的乘积里,末尾0的个数最少,要求输出最有解和走法。不用怎么想也知道基本是个dp了,可以发现其实只有2和5的因子是原创 2010-02-26 11:44:00 · 1296 阅读 · 0 评论 -
topcoder配置
一般来说,我们安装这三个插件就够了:“FileEdit,CodeProcessor ,TZTester”,把他们下载了之后,放在一个文件夹里面,并且要保证以后不要移动这个文件夹的位置(该文件夹尽量处在桌面路径附近)! 一:登陆arena之后,选择:Options → Editors,调出了新的窗口,按Add在name栏填FileEdit,EntryPoint栏填fileedit.Ent转载 2010-03-05 10:40:00 · 1942 阅读 · 1 评论 -
SRM 457 Div2 500
非常非常恶心的一个题目。。。想到写了之后基本错误,最后写了半个小时,没弄对。。。感叹啊,这个题怎么这么恶心。今天早晨起床,想起来了。。网上一个,找到了一个异常优美的解答!太强大了!!! 后面附一篇sprintf的用法的文章,有点像C++的istringstream和ostringstream #include #include #include #include原创 2010-01-05 09:41:00 · 957 阅读 · 0 评论 -
ProjectEluer 70
// BEGIN CUT HERE// END CUT HERE#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include原创 2010-04-08 18:57:00 · 802 阅读 · 0 评论 -
IDI Open 2007解题报告
1 A Help Chelsea! Easy 输出一串数的最大值。。这个题目也太无聊了点吧。。 2 G Fridge of Your Dreams Easy 这个题目更无聊,把24位的二进制转化为十进制。。 3 B Virus Medium 先前想法: 可以很容易的想到这个问题是没有数学解的。。因为你必须在前n步中查询才能够获得我下一步的前进方向。只有这些值得到了才能够获得数学解 此时优化的余地就不是很大了。。所以我们采用模拟的解法,保存两个数组,一个是数量数组,一原创 2010-08-22 22:44:00 · 834 阅读 · 0 评论 -
[Asia - Hefei - 2008/2009][B:Discrete Square Roots][数论基础]
<br /> 看了一下问题,大家可以到ACM/ICPC的那个网站上搞到题目<br />A square root of a number x is a number r such that r2 = x . A discrete square root of a non-negative integer x<br />is a non-negative integer r such that r2 x mod N , 0 r < N , where N is a specific positive i原创 2010-08-21 18:59:00 · 824 阅读 · 0 评论 -
SRM 454 Round1 500
http://www.topcoder.com/wiki/display/tc/SRM+454 动态规划的一个经典题目。找到第i个与第i+1个的关系。同时对于此种问题。正确的表示数据,把火柴表示成数字形式,同时计算其差异对于只有对于移入与移除相同的火柴的时候,才是我们所求的答案//So we just want to know at a position N, if we m原创 2009-12-17 09:53:00 · 551 阅读 · 0 评论 -
Topcoder SRM 462 DIV 2
第一个问题很弱智。。。EasyPass第二个问题,一开始看到这个问题想入非非了。。很明显高阶方程无解啊。。。想了好久想到了数值解。。。很明显牛顿二分法么。。然后这个没有严格想限制条件就动手了。。期间被精度搞错了一次。。。以后做题注意精度!注意边界条件。。。这个题目fail了好多。。。。。。正杯具啊。。第三题是DP题目,很显然的。#include #include #in原创 2010-02-18 14:57:00 · 696 阅读 · 0 评论 -
Marathon Match概述(1)
Marathon Match概述(1) 从下个月开始,做一下Marathon Match的题目,这个和研究还比较像。。下午读了一下Marathon的提示,有好多。。首先Marathon Match开宗明义的告诉你:test your ingenuity, determination and intelligence.下面摘了一些。。 Its entire原创 2009-10-28 16:10:00 · 691 阅读 · 0 评论 -
ULM local 2009 G
Problem G: Generate random numbers题目给出了John von Neumann的一种生成随机数的方法: We choose an initial value a0, which has a decimal representation of length at most n. We then multiply the value a0 by itsel原创 2009-10-28 20:58:00 · 557 阅读 · 0 评论 -
SRM 452 DIV2 Problems 1000
SRM 452 DIV2Problems 1000题目:http://www.topcoder.com/stat?c=problem_statement&pm=10572&rd=13906解答:If there exist loop formed by required edges or node with degree > 2, then the answer is 0原创 2009-11-09 12:52:00 · 546 阅读 · 0 评论 -
SRM 451 DIV 2 1000
题目:http://www.topcoder.com/stat?c=problem_statement&pm=10634解题方法:Let assume we have only one boy and he delivers a set S of pizza from the given pizzas. let m be the size of the set S. le原创 2009-11-11 21:18:00 · 537 阅读 · 0 评论 -
Usaco Section 2.1 The Castle
题目:http://ace.delos.com/usacoprob2?a=eURSI1UXlof&S=castlefloodfill算法的典型应用! /*ID: lvxiaol3PROG: castleLANG: C*/#include #include #include #include #define MAXDIM 50#defi原创 2009-11-18 13:57:00 · 490 阅读 · 0 评论 -
Usaco Section 2.1 Ordered Fractions
http://ace.delos.com/usacoprob2?a=RTmsdUP0y2Y&S=frac1//一个非常巧妙的方式输出了所有大小排序既约分数//注意其输出顺序的对应/*ID: lvxiaol3PROG: frac1LANG: C++*//*0/1原创 2009-11-18 14:47:00 · 511 阅读 · 0 评论 -
SRM 458 Div 2
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #i原创 2010-01-16 13:40:00 · 692 阅读 · 0 评论 -
SRM 459 DIV 2
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #i原创 2010-01-21 14:53:00 · 635 阅读 · 0 评论 -
棋盘问题
校内转载---->很有意思!Alice和Bob两人玩一种硬币游戏。游戏在一个2*2的棋盘上进行,棋盘上每个格子上都有一枚硬币。在每一回合,Alice可以决定选择翻转某两枚或者一枚硬币,接着Bob可以选择将棋盘旋转90,180或者270度,也可以什么都不做。Alice在整个游戏过程中,不知道游戏刚开始棋盘的状态,也无法看到棋盘上的硬币,甚至不知道Bob每回合是否旋转了棋盘。游戏轮转载 2010-01-22 17:07:00 · 968 阅读 · 1 评论 -
POJ 2186 强连通分量
比较简单吧。。套模板。。Gabow#include "cstdlib" #include "cctype" #include "cstring" #include "cstdio" #include "cmath" #include "algorithm" #include "vector" #include "string" #include "iostream" #i原创 2010-09-27 16:35:00 · 902 阅读 · 0 评论