02 2017 档案
摘要:题目描述 动物王国中有三类动物 A,B,C,这三类动物的食物链构成了有趣的环形。A 吃 B,B 吃 C,C 吃 A。 现有 N 个动物,以 1 - N 编号。每个动物都是 A,B,C 中的一种,但是我们并不知道 它到底是哪一种。 有人用两种说法对这 N 个动物所构成的食物链关系进行描述: 第一种说法
阅读全文
摘要:描述 公元五八○一年,地球居民迁移至金牛座α第二行星,在那里发表银河联邦创立宣言,同年改元为宇宙历元年,并开始向银河系深处拓展。 宇宙历七九九年,银河系的两大军事集团在巴米利恩星域爆发战争。泰山压顶集团派宇宙舰队司令莱因哈特率领十万余艘战舰出征,气吞山河集团点名将杨威利组织麾下三万艘战舰迎敌。 杨威
阅读全文
摘要:题目描述 洛谷p1892 1920年的芝加哥,出现了一群强盗。如果两个强盗遇上了,那么他们要么是朋友,要么是敌人。而且有一点是肯定的,就是: 我朋友的朋友是我的朋友; 我敌人的敌人也是我的朋友。 两个强盗是同一团伙的条件是当且仅当他们是朋友。现在给你一些关于强盗们的信息,问你最多有多少个强盗团伙。
阅读全文
摘要:#include #include #include #include #include #include #include using namespace std; int n; int to[210000],dfn[210000],ans=999999,cnt=0,cntt=0,t[210000]; void dfs(int x) { t[x]=cntt; dfn[x]=+...
阅读全文
摘要:弄了大半天,结果忘了调用数组。#include<iostream>#include<cstdio> for(int i=1;i<=n;i++) money[i]=100; for(int k=1;k<=n;k++) { for(int i=1;i<=n;i++) if(!son[i]) { cnt+
阅读全文
摘要:当成搜索题来做的, 直接搜肯定不行需要优化一下,权值打表就行了。 先搜索最少的,可以减少运算次数。 用二进制数表示某个数是否能用。 位运算还没写好
阅读全文
摘要:#include #include #include #include #include using namespace std; #define M 100000 char al[M],bl[M]; int a[M],b[M],c[M]; int longa,longb; void yawei() { int i,j,k=1; for( i=longa-1,j=1;i>=0;...
阅读全文
摘要:#include #include #include #include using namespace std; int n,m,v[999999],w[999999],ans=0; void dfs(int x,int y,int z) { if(x==n+1) if(y>m) return ; else {ans=max...
阅读全文
摘要:#define INF 9999999 int n,a[99999],dp[9999][9999],ans=9999999,s[9999]; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]),a[n+i]=a[i],s[i]=s[i-1]+a[i]; for(...
阅读全文
摘要:1 #define INF 100099 2 int n,m,a[99999],s[99999],ans; 3 void dfs(int x,int y) 4 { 5 if(x==n+1) return; 6 else{ 7 if(a[x-1]<a[x]) s[x]=s[x-1]+1,dfs(x+1,s[x]); 8 ...
阅读全文