• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
tmeteorj
Nothing is so big that it is impossible to get over, and hurt only serves to make us stronger. 没有什么事是大到无法战胜的,痛苦也只会让我们变得更加坚强。
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页

2012年10月9日

POJ 2425
摘要: 题意:给定一个有向无环图,然后上面的一些结点上面有棋子,每次一个人可以选择一枚棋子走到与它相邻的点,不能走的就输了。然后给出初态,判断胜负。题解:图上面的SG博弈,dfs求SG函数,然后依次取异或就行了。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 int sg[1005],head[1005],nc; 6 struct Edge 7 { 8 int to,next; 9 }edge[1000000];10 voi 阅读全文
posted @ 2012-10-09 20:07 tmeteorj 阅读(440) 评论(0) 推荐(0)
 
POJ 3994
摘要: 题意/题解:大水题,不想说了。View Code 1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 4 int main() 5 { 6 int ca=0,n; 7 while(scanf("%d",&n),n) 8 printf("%d. %s %d\n",++ca,(n%2==0)?"even":"odd",(3*n+1)/2/3); 9 return 0;10 } 阅读全文
posted @ 2012-10-09 19:34 tmeteorj 阅读(187) 评论(0) 推荐(0)
 
POJ 3192
摘要: 题意:给定n个DNA字符串,然后可以让两个DNA端点部分交叉,条件是这端点部分能够匹配。问将n个DNA连成一串的最小长度。题解:像这种n那么小的题就是在诱惑人去暴力,枚举n个DNA的构造顺序,然后依次连接。View Code 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 using namespace std; 5 bool vis[10]; 6 char s[10][10]; 7 int n,ans,per[10]; 8 void link(char s1[],char s2[ 阅读全文
posted @ 2012-10-09 19:11 tmeteorj 阅读(294) 评论(0) 推荐(0)
 
POJ 3088
摘要: 题意:有一种锁,由B个数字构成。锁会选取<=B的数字分成任意份,然后份与份之间可以任意排列,求这种锁的种数。题解:枚举选从B个中选i个,然后在枚举i分成j份的方法,分成j份的方法即斯特林数,最后再乘以j的全排。View Code 1 #include<cstdio> 2 #include<cstring> 3 using namespace std; 4 typedef long long LL; 5 LL s[12][12],c[12][12],f[12]; 6 int main() 7 { 8 s[0][0]=1; 9 c[0][0]=1;10 f[0]=1; 阅读全文
posted @ 2012-10-09 14:58 tmeteorj 阅读(188) 评论(0) 推荐(0)
 
POJ 3475
摘要: 题意:一个矩形盒子,一张矩形纸,要通过折叠然后使得纸能装进盒子中,求次数。题解:简单题,但是题无难易,悉以A之。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 int main() 6 { 7 double a,b,c,d; 8 while(scanf("%lf%lf%lf%lf",&a,&b,&c,&d)!=EOF) 9 {10 int ans=0;11 if(a 阅读全文
posted @ 2012-10-09 14:24 tmeteorj 阅读(145) 评论(0) 推荐(0)
 
POJ 2817
摘要: 题意:给出n个字符串,把它们排成n列。相邻两列上下有k个字母对应相同就可以获得k分,并可以添加前导空格。问最高分数。题解:n最大才10,10!枚举排列,然后预处理任意两串字母的最大得分即可。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 char s[12][12]; 6 int n,res; 7 int cac[12][12]; 8 bool vis[12]; 9 void dfs(int k,int lx,int 阅读全文
posted @ 2012-10-09 13:21 tmeteorj 阅读(437) 评论(7) 推荐(0)
 
POJ 3385
摘要: 题意:外星人族谱长得很奇葩,AP想把它变得好看一些,好看的定义就是每个结点至多有d个parents,如果它本身超过了,就需要增加虚拟结点???来扩展,问最少需要加多少个虚拟结点。题解:先统计每个孩子的parents个数,如果对于一个外星人,如果它parents个数为m,超过了d,假设要增加k个虚拟结点,那么必须满足m-k*d<=d-k,于是k>=(m-d)/(d-1)View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace st 阅读全文
posted @ 2012-10-09 12:48 tmeteorj 阅读(181) 评论(0) 推荐(0)
 
POJ 3697
摘要: 题意:给出一个n个点的无向完全图,然后删去m条边,问还有哪些点与1相连(不包括1)题解:n<=10000,m<=1000000,若直接建反图无论怎样都会暴内存,因为最多1Y条边。于是将删去的边存入hash表中,每次走动时看看边是否在hash表中即可。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int mod=10000007; 6 int hash[mod]; 7 int getkey(i 阅读全文
posted @ 2012-10-09 12:32 tmeteorj 阅读(277) 评论(2) 推荐(0)
 
POJ 3263
摘要: 题意:n头牛排成一行,告诉你最高的牛的高度h以及位置i,然后有r个信息(x,y),告诉你第x头牛向某一个方向最多可以看到第y头牛,即位于[x+1,y-1]区间内的牛都比它小,问每头牛最大可能高度是多少。题解:对每个信息(x,y)建立区间[x+1,y-1],并标记属于区间的左还是右,意味着这区间里的牛会被至少有一头牛给高度鄙视= =!然后,就是求区间的重叠数了,某个点的区间重叠数是k,那么它的最大高度就是h-k,另外需要注意的就是,要自己去重,题目可能有完全相同的冗余信息,这些信息都应该只记录一次,即哪怕一头牛身高在不堪,也不能被同一头牛给反反复复鄙视,鄙视可是要降身高的啊~~View Code 阅读全文
posted @ 2012-10-09 09:18 tmeteorj 阅读(369) 评论(0) 推荐(0)
 
POJ 3561
摘要: 题意:给定一张n*m的图,上面有4种线段,'-','|','\','/',判断图上是否有且仅有一条这样的线段。题解:遍历每个点,如果不是空,就将它所在的直线给删掉,并且记录值加一,最后判断记录是否等于一即可。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 char map[20][20]; 6 int r,c; 7 int dr[200][2]; 8 v 阅读全文
posted @ 2012-10-09 08:52 tmeteorj 阅读(247) 评论(0) 推荐(0)
 
 
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3