上一页 1 ··· 7 8 9 10 11 12 13 14 下一页
摘要: 1 #include<stdio.h> 2 #include<algorithm> 3 #include<stdlib.h> 4 using namespace std; 5 6 typedef struct 7 { 8 int x; 9 int y;10 }node;11 12 int fun(int a)13 {14 int t=0;15 while(a)16 {17 t=t*10+a%10;18 a=a/10;19 }20 return t;21 }22 23 int cmp(const nod... 阅读全文
posted @ 2013-04-06 10:36 萧凡客 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 int a[1000]; 4 5 void fun(int n) 6 { 7 int i,t,v; 8 v=0; 9 for(i=0;i<1000;i++)10 {11 t=a[i]*n+v;12 a[i]=t%10;13 v=t/10;14 }15 }16 17 int main()18 {19 int i,j,n,m;20 scanf("%d",&n);21 while(n--)22 ... 阅读全文
posted @ 2013-04-06 10:35 萧凡客 阅读(303) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 using namespace std; 3 const int N = 11; 4 int Board[N][N]; 5 int tile = 0; 6 7 /* 8 tr:棋盘左上角方格的行号 9 tc:棋盘左上角方格的列号10 dr:特殊方格所在的行号11 dc:特殊方格所在的列号12 size:方形棋盘的边长13 */14 void ChessBoard(int tr, int tc, int dr, int dc, int size)15 {16 if(size == 1)17 return;18 ... 阅读全文
posted @ 2013-04-05 20:27 萧凡客 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 4 int main() 5 { 6 int i,j,f[100],t[1000],w[100],T,M; 7 scanf("%d%d",&T,&M); 8 for(i=0;i<M;i++) 9 scanf("%d%d",&t[i],&w[i]);10 memset(f,0,sizeof(f));11 for(i=0;i<M;i++)12 for(j=T;j>=t[i];j--)13 f[j]=f 阅读全文
posted @ 2013-04-05 19:36 萧凡客 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1 double p(int m,int n) 2 { 3 double a,b; 4 if(n==1) return (double)m; 5 else b=p(m,n/2); 6 a=b*b; 7 if(n%2==1) 8 a=a*m; 9 return a;10 } 阅读全文
posted @ 2013-04-05 09:36 萧凡客 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 3 int n,l; 4 char s[100]; 5 6 int dfs(int cur) 7 { 8 int i,j,ok,equal,k; 9 if(cur==n)10 {11 for(i=0;i<n;i++)12 printf("%c",'A'+s[i]);13 printf("\n");14 return 0;15 }16 for(i=0;i<l;i++)17 {18 s[cur]=i;19 ... 阅读全文
posted @ 2013-04-03 22:25 萧凡客 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 #include<queue> 4 using namespace std; 5 6 const int max=100; 7 int c[3]; 8 int w; 9 int vis[max][max];10 int m;11 typedef struct 12 {13 int v[3];14 int deep;15 //ruct node *fa;16 //t a;17 //t b;18 }node;19 20 21 int bfs()22 {23 in... 阅读全文
posted @ 2013-04-03 17:53 萧凡客 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 /*下面定义结点的类型*/ 5 #define Min(a,b) ((a>b)?b:a) 6 //宏定义的操作符Min作用 取最小值; 7 const int MAX=1010; 8 //解答树的结点最多 9 typedef struct Node 10 { 11 int v[3];//三个杯子的剩余水量; 12 int fa;//第一次访问到这个结点是的前一个结点的下标; 13 //通过下... 阅读全文
posted @ 2013-04-01 22:25 萧凡客 阅读(1923) 评论(0) 推荐(1) 编辑
摘要: /* * biao.cpp * * Created on: 2011-11-25 * Author: allenjin */ #include#include using namespace std; template class Stack{ //自定义堆栈公式化描述 pub... 阅读全文
posted @ 2013-03-24 10:53 萧凡客 阅读(189) 评论(0) 推荐(0) 编辑
摘要: #include<math.h> #include<stdio.h> #define Z 1e-6 //因为实数是否为0的判断不能用'==',而取而代之的是判断其是否小于一个很小的数,这里用10^(-6) double a[4];//必须是double型的,我刚开始是用float,结果贡献了几个WA bool f(int n) { if(n==1){//最后处理完毕,即到达解答树叶子节点 if(fabs(a[0]-24)<Z) return 1;//假如最后结果==24,则返回1 else return 0; } for(int ... 阅读全文
posted @ 2013-03-24 10:46 萧凡客 阅读(165) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 下一页