上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 42 下一页
摘要: 题意看不懂的直接看百度百科对黑白棋的解释。。。做法:分情况讨论,一共8个方向。 1 /* 2 搜索 3 */ 4 #include 5 #include 6 const int maxn = 10; 7 char mat[ maxn ][ maxn ]; 8 const int dx[]={-1,1,-1,1}; 9 const int dy[]={1,-1,-1,1}; 10 11 int max( int a,int b ){ 12 return a>b?a:b; 13 } 14 15 bool in( int x,int y ){ 16 if( x>... 阅读全文
posted @ 2013-07-18 10:18 xxx0624 阅读(304) 评论(0) 推荐(0) 编辑
摘要: 原文地址:http://blog.sina.com.cn/s/blog_49c5866c0100f3om.html其实也谈不上推荐,只是自己做过的题目而已,甚至有的题目尚未AC,让在挣扎中。之所以推荐计算几何题,是因为,本人感觉ACM各种算法中计算几何算是比较实际的算法,在很多领域有着重要的用途计算... 阅读全文
posted @ 2013-07-17 16:13 xxx0624 阅读(497) 评论(0) 推荐(0) 编辑
摘要: 简单的BFS 1a 1 /* 2 从起点到终点 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 12 const int maxn = 12;13 const int Max = 99999999;14 char mat[ maxn ][ maxn ][ maxn ];15 int vis[ maxn ][ maxn ][ maxn ];16 const int dx[]={0,0,1,-1,0,0};17 const int dy[]={1,-1,. 阅读全文
posted @ 2013-07-16 21:01 xxx0624 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 int son[ 1005 ]; 4 int main(){ 5 int n,m; 6 while( scanf("%d%d",&n,&m)==2 ){ 7 for( int i=0;i0 ){13 sum += (int)pow( 1.0*son[i],m );14 }15 }16 }17 else{18 for( int i=0;i<n;i++ ){19 ... 阅读全文
posted @ 2013-07-14 17:27 xxx0624 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 RMQ 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 using namespace std;11 const int maxn = 50005;12 struct Node{13 int ki,ai,id;14 }node[ maxn ];15 int dp[ maxn ][ 24 ];16 int bit[ 32 ];17 int ans[ maxn ][ 3 ];18 19 void init(){20 memset( ans,0,sizeof( ans )... 阅读全文
posted @ 2013-07-14 12:18 xxx0624 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 简单。手动的实现全排列 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int maxn = 24; 7 8 struct node{ 9 char a,b,aa; 10 int c,d,val; 11 }p[ 5 ],temp; 12 13 struct node2{ 14 node tt[5]; 15 int most; 16 }ans[ 122 ]; 17 18 int cmp( node a,node b ){ 19 re... 阅读全文
posted @ 2013-07-13 17:41 xxx0624 阅读(522) 评论(1) 推荐(0) 编辑
摘要: 模拟BFS搜索对于一个将要爆炸的点,可能同时由多个点引起。 1 /* 2 模拟搜索过程 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 const int maxn = 8;11 int mat[ maxn ][ maxn ];12 int mytime[ maxn ][ maxn ];13 const int dx[] = {0,0,-1,1};14 const int dy[] = {1,-1,0,0};15 struct node{16 int x,y,ti,... 阅读全文
posted @ 2013-07-13 15:20 xxx0624 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 一开始TLE了。。。 1 /* 2 模拟 3 */ 4 #include 5 #include 6 const int maxn = 10005; 7 typedef __int64 int64; 8 int64 a[ maxn ]; 9 int main(){10 int64 k;11 int n,k1,k2 ;12 int T;13 scanf("%d",&T);14 int ca = 1;15 while( T-- ){16 scanf("%d%d%d%I64d",&n,&k1,&k2,&k);17 int6 阅读全文
posted @ 2013-07-11 22:21 xxx0624 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 题意很简单。一次最多多切出一条边!其余的就没什么好说的了 1 import java.util.*; 2 import java.math.*; 3 public class Main{ 4 public static void main( String[] args ){ 5 Scanner cin = new Scanner( System.in ); 6 BigInteger n,m,p; 7 while( cin.hasNext() ){ 8 n = cin.nextBigInteger(); 9 ... 阅读全文
posted @ 2013-07-11 21:26 xxx0624 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 简单。 1 #include 2 #include 3 const int maxn = 1000006; 4 int a[ maxn ]; 5 int main(){ 6 int ca; 7 scanf("%d",&ca); 8 while( ca-- ){ 9 int n;10 scanf("%d",&n);11 for( int i=0;i=a[ i ] ){17 a[ i+1 ] -= a[ i ];18 a[ i ] = 0;19 ... 阅读全文
posted @ 2013-07-11 16:39 xxx0624 阅读(156) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 42 下一页