上一页 1 ··· 8 9 10 11 12 13 下一页

2012年8月3日

hdu2036 改革春风吹满地

摘要: 1 #include<math.h> 2 #include<stdio.h> 3 int main() 4 { 5 int i,n,a[110][2]; 6 double s; 7 while(scanf("%d",&n),n) 8 { 9 for(s=i=0;i<n;i++)10 scanf("%d%d",&a[i][0],&a[i][1]);11 for(i=2;i<n;i++)12 s+=(a[i][1]-a[i-1][1])*(a[0][0]-a[i][0]) //注意是有向面积,因为. 阅读全文

posted @ 2012-08-03 18:42 小花熊 阅读(184) 评论(0) 推荐(0) 编辑

poj1298 The Hardest Problem Ever

摘要: 1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 int main() 5 { 6 char *p,s[201]; 7 while(cin.getline(s,100),strcmp(s,"ENDOFINPUT")) 8 { 9 if(!strcmp(s,"START")) continue;10 else if(!strcmp(s,"END")) continue;11 else{12 for(p=s;*p;p++... 阅读全文

posted @ 2012-08-03 15:49 小花熊 阅读(163) 评论(0) 推荐(0) 编辑

nyoj305 表达式求值

摘要: 1 #include<stdio.h> 2 char s[301],cstack[120]; 3 int dstack[80]; 4 int i,ctop,dtop; 5 int Operate(int a,char theta,int b) 6 { 7 switch(theta){ 8 case 'd': return a+b; 9 case 'n': return a>b?b:a;10 case 'x': return a>b?a:b;11 }12 }13 int EvaluateExpression()14 {15 阅读全文

posted @ 2012-08-03 12:41 小花熊 阅读(224) 评论(0) 推荐(0) 编辑

poj2255 Tree Recovery

摘要: 1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 using namespace std; 5 struct Node 6 { 7 char data; 8 Node *lchild; 9 Node *rchild;10 };11 Node *CreatTree(string pre,string in)12 {13 Node *root=NULL;14 if(pre.length()>0)15 {16 root=new Node;17 ... 阅读全文

posted @ 2012-08-03 09:35 小花熊 阅读(155) 评论(0) 推荐(0) 编辑

2012年8月2日

poj1363 Rails

摘要: 1 #include<stdio.h> 2 int main() 3 { 4 int Sq[1000],a[1000]; 5 int i,k,n,head; 6 while(~scanf("%d",&n),n){ 7 while(scanf("%d",&a[0]),a[0]){ 8 for(head=0,i=1;i<n;++i) 9 scanf("%d",&a[i]);10 for(i=1,k=0;k<n;++k){11 while(i<a[... 阅读全文

posted @ 2012-08-02 16:47 小花熊 阅读(223) 评论(0) 推荐(0) 编辑

nyoj128 前缀式计算

摘要: 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #define N 1010 5 char s[N]; 6 //数字栈的操作 7 typedef struct 8 { 9 float *base; 10 float *top; 11 }SqStack; 12 int InitStack(SqStack &S) 13 { 14 S.base=(float *)malloc(N/2*sizeof(float)); 15 S.top=S.base; 16 return 1; 1 阅读全文

posted @ 2012-08-02 10:14 小花熊 阅读(196) 评论(0) 推荐(0) 编辑

nyoj467 中缀式变后缀式

摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #define N 1010 4 //字符栈的操作 5 typedef struct 6 { 7 char *base; 8 char *top; 9 }SqStack; 10 int InitStack(SqStack &S) 11 { 12 S.base=(char *)malloc(N*sizeof(char)); 13 if(!S.base) exit(1); 14 S.top=S.base; 15 return 1; 16 } 17 int StackE... 阅读全文

posted @ 2012-08-02 08:39 小花熊 阅读(317) 评论(0) 推荐(0) 编辑

nyoj267 郁闷的C小加(二)

摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #define N 1010 4 char s[N]; 5 int i; 6 //字符栈的操作 7 typedef struct 8 { 9 char *base; 10 char *top; 11 }SqStack1; 12 int InitStack1(SqStack1 &S) 13 { 14 S.base=(char *)malloc(N*sizeof(char)); 15 if(!S.base) exit(1); 16 S.top=S.base; 17 ... 阅读全文

posted @ 2012-08-02 08:37 小花熊 阅读(259) 评论(0) 推荐(0) 编辑

nyoj35 表达式求值

摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #define N 1010 4 char s[N]; 5 //字符栈的操作 6 typedef struct 7 { 8 char *base; 9 char *top; 10 }SqStack1; 11 int InitStack1(SqStack1 &S) 12 { 13 S.base=(char *)malloc(N*sizeof(char)); 14 if(!S.base) exit(1); 15 S.top=S.base; 16 return 1; ... 阅读全文

posted @ 2012-08-02 08:36 小花熊 阅读(347) 评论(0) 推荐(0) 编辑

nyoj257 郁闷的C小加(一)

摘要: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #define N 1010 4 //字符栈的操作 5 typedef struct 6 { 7 char *base; 8 char *top; 9 }SqStack; 10 int InitStack(SqStack &S) 11 { 12 S.base=(char *)malloc(N*sizeof(char)); 13 if(!S.base) exit(1); 14 S.top=S.base; 15 return 1; 16 } 17 int StackE... 阅读全文

posted @ 2012-08-02 08:36 小花熊 阅读(252) 评论(0) 推荐(0) 编辑

上一页 1 ··· 8 9 10 11 12 13 下一页

导航