摘要: 知道是状态压缩,但是不会做;看题解学的;dp[i]表示现在状态是i,先手-后手的分数。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int b,g,n,s,a,co[20],dd[20]; 7 int map[25][20],dp[10)dp[i]=max(dp[i],cnt+dp[i^(1<<j)]);53 else dp[i]=max(dp[i],-dp[i^(1<<j)]);54 }55 }56 }57 ... 阅读全文
posted @ 2013-11-12 20:41 Yours1103 阅读(222) 评论(0) 推荐(0) 编辑
摘要: set的利用; 1 #include 2 #include 3 #include 4 #define maxn 100009 5 using namespace std; 6 7 struct node 8 { 9 int w,h;10 bool operator s;18 multiset::iterator it;19 int main()20 {21 int n,t;22 scanf("%d",&t);23 while(t--)24 {25 scanf("%d",&n);26 s.clear();27 ... 阅读全文
posted @ 2013-11-12 18:59 Yours1103 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 难得一次比赛能够自己成功A掉四个题;A题:水题,模拟一下就行; 1 #include 2 #include 3 using namespace std; 4 5 void print(int x) 6 { 7 if(x>=5){printf("-O|");x%=5;} 8 else printf("O-|"); 9 if(x==0)puts("-OOOO");10 else if(x==1)puts("O-OOO");11 else if(x==2)puts("OO-OO");12 els 阅读全文
posted @ 2013-11-12 17:03 Yours1103 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 一个很不错的题;刚刚看到这个题目就感觉要用线段树或者树状数组,但是有感觉有点不同;敲了一发简单的线段树之后果断的T了;网上一搜题解,发现要用55颗线段树或者树状数组;一共有k种树,然后每种树根据他们%k的余数的不同又分成好几颗;然后最后统计的时候只要对每个节点统计这k种树种的信息就行; 1 #include 2 #include 3 #define maxn 50005 4 using namespace std; 5 6 int d[100][maxn],num[maxn]; 7 int n,q; 8 void insert(int k,int p,int v) 9 {10 whi... 阅读全文
posted @ 2013-11-12 16:57 Yours1103 阅读(182) 评论(0) 推荐(0) 编辑
摘要: A:简单题: 1 #include 2 using namespace std; 3 4 int n,k; 5 int main() 6 { 7 scanf("%d%d",&n,&k); 8 for(int i=0; i 2 using namespace std; 3 4 int n,k; 5 int main() 6 { 7 scanf("%d%d",&n,&k); 8 if((n==1&&k==1)||k==n) 9 {10 puts("-1");11 return 0;12 }1 阅读全文
posted @ 2013-11-12 10:43 Yours1103 阅读(179) 评论(0) 推荐(0) 编辑