随笔分类 -  CONTEST 比赛

Binary Operation
摘要:题意:a1⊙a2⊙a3= a1⊙a2+ a1⊙a3+ a2⊙a3a1⊙a2⊙a3⊙a4= a1⊙a2+ a1⊙a3+ a1⊙a4+ a2⊙a3+ a2⊙a4+ a3⊙a4算法:1.朴素算法O(n ^2),肯定不行,百万级别数据2.考虑二进制性质,统计所有位1的个数,由异或可知,0,1为1分别统计每位的和。比如第1位sum += (N - bit[1]) * bit[1] * (1<<i)View Code #include<stdio.h>#include<string.h>#include<stdlib.h>int d[40];int main 阅读全文

posted @ 2012-07-30 16:48 more think, more gains 阅读(213) 评论(0) 推荐(0)

Developing school contest 2
摘要:Problem HTime Limit : 3000/1000ms (Java/Other)Memory Limit : 65535/32768K (Java/Other)Total Submission(s) : 100Accepted Submission(s) : 63Font:Times New Roman|Verdana|GeorgiaFont Size:←→Problem DescriptionNow that spring is here and the sun is shining bright, people are starting to lower their blind 阅读全文

posted @ 2012-07-22 20:46 more think, more gains 阅读(278) 评论(0) 推荐(0)

Problem K. 找宝箱
摘要:Problem K. 找宝箱Time Limit: 2000ms Memory Limit: 65536kbDescription作为一个强迫症患者,小 Y 在走游戏里的迷宫时一定要把所有的宝箱收集齐才肯罢休。现在给你一个 N  M 的迷宫,里面有障碍、空地和宝箱,小 Y 在某个起始点,每一步小 Y 可以往上下左右走,当然前提时没有走出迷宫并且走到的点不是障碍。如果小 Y 走到了某个为宝箱的点,那么这个宝箱就被他收集到了,然后此处变为空地。现在你需要计算小 Y 最少需要走多少步才能收集齐所有的宝箱。Input输入包含多组数据。对于每组数据,第一行两个正整数 N;M (1  N;M  10 阅读全文

posted @ 2012-07-16 08:56 more think, more gains 阅读(336) 评论(0) 推荐(0)

1566: 碰撞检测 contest 4
摘要:1566: 碰撞检测Time Limit: 1 SecMemory Limit: 128 MBSubmit: 52Solved: 11[Submit][Status][Web Board]Description小毛在做计算几何题时,遇到一个问题:在3D空间里有一个球体和一个长方体,判断它们是否会发生碰撞(collision)。小毛想了半天都没想出来,只有靠你去解决它了。Input第一行一个整数T,表示案例数。每个案例两行,第一行24个整数,分别为X1,Y1,Z1,X2,Y2,Z2...X8,Y8,Z8,表示一个长方体的8个顶点的空间位置,(注意:输入保证每个长方体的各边平行于坐标轴)。第二行4 阅读全文

posted @ 2011-08-04 11:04 more think, more gains 阅读(200) 评论(0) 推荐(0)

strange lift contest4 简单bfs
摘要:#include <stdio.h>#include <deque>#include <string.h>using namespace std; deque<int>q;int dp[4000000];int floor[110000];int visit[1100]; int main( ){ int N, i, t, v,s ,e, flag; while (scanf("%d",&N), N){ flag = 0; q.clear(); scanf("%d%d",&s,&e) 阅读全文

posted @ 2011-08-04 07:45 more think, more gains 阅读(152) 评论(0) 推荐(0)

组合问题 contest4
摘要:1574: 组合问题Time Limit: 1 SecMemory Limit: 128 MBSubmit: 78Solved: 23[Submit][Status][Web Board]Description有n 种颜色的球,每种颜色的球的个数有任意多个,从中取m个,问有多少种取法Input每行2个正整数 n,m(<=31) ,n=0,m=0结束. Output输出有多少种取法Sample Input2 23 30 0Sample Output310#include<stdio.h>long long m1[40],m2[40],n,m;void gf( ){ for( l 阅读全文

posted @ 2011-08-04 07:43 more think, more gains 阅读(155) 评论(0) 推荐(0)

Game contest4
摘要:1569: GameTime Limit: 8 SecMemory Limit: 128 MBSubmit: 57Solved: 16[Submit][Status][Web Board]DescriptionTic-tac-toe is the third most popular activity to kill a lazy afternoon in Ardenia (right after solving puzzles and insulting your neighbors). Arthum and Breece are not fans of this game, but the 阅读全文

posted @ 2011-08-04 07:42 more think, more gains 阅读(360) 评论(0) 推荐(0)

Math one poj 3372 contest4
摘要:#include <iostream> #include <cstdio> using namespace std; int main() { int n; while(scanf("%d", &n)!= EOF) { if (!(n&(n-1))) { printf("YES\n"); } else printf("NO\n"); } } 证明:http://www.cnblogs.com/Saatgut/archive/2008/10/09/1307405.html 阅读全文

posted @ 2011-08-04 07:21 more think, more gains 阅读(157) 评论(0) 推荐(0)

约瑟夫环 循环链表 contest 4
摘要:1573: Math twoTime Limit: 1 SecMemory Limit: 128 MBSubmit: 71Solved: 27[Submit][Status][Web Board]Description有N个小孩围成一圈,给他们从1开始依次编号,现指定从第W个开始报数,报到第S个时,该小孩出列,然后从下一个小孩开始报数,仍是报到S个出列,如此重复下去,直到所有的小孩都出列(总人数不足S个时将循环报数),求小孩出列的顺序。Input第一行输入小孩的人数N(N<=64)接下来每行输入一个小孩的名字(人名不超过15个字符)最后一行输入W,S (W < N),用逗号&quo 阅读全文

posted @ 2011-08-04 07:03 more think, more gains 阅读(172) 评论(0) 推荐(0)

平方数 contest 4
摘要:1565: 平方数Time Limit: 1 SecMemory Limit: 128 MBSubmit: 22Solved: 13[Submit][Status][Web Board]Description定义一类整数叫K-Omitted-Square-Number(K-OSN),如果数N是K-OSN必须满足下列条件:(1) 它是一个完全平方数。(2) 它的最末一位不为零。(3) 它不小于10的K次方。(4) 它的最后K位被截去后,所得的结果仍旧是一个完全平方数。现在给你一个正偶数K,求它的最大K-OSN。Input有多个案例。第一行为T(T<=20),是案例数,每个案例(一行)都只有 阅读全文

posted @ 2011-08-04 00:16 more think, more gains 阅读(189) 评论(0) 推荐(0)

导航