关于poj_problem_2027
程序代码:
#include <stdio.h> struct node{ int e; struct node *next; }; struct dlie{ struct node *first; struct node *tail; }; int build(struct dlie *D){ D->first = D->tail = (struct node *)malloc(sizeof(struct node)); if(!D->first)return 0; D->tail->next = NULL; return 1; } int add(struct dlie *D,int e){ D->tail->e = e; D->tail->next = (struct node *)malloc(sizeof(struct node)); if(!D->tail->next)return 0; D->tail = D->tail->next; D->tail->next = NULL; return 1; } int out(struct dlie *D){ int e; if(D->first == D->tail){ e = D->first->e; return e; } else{ struct node *p; p = D->first; e = p->e; D->first = D->first->next; free(p); return e; } } int done(int a,int b){ if(a >= b)return 0; else return 1; } void main(){ struct dlie dlie1; int i = 0,a,b,c,e; scanf("%d",&c); build(&dlie1); for(i = 0;i < c;i++){ scanf("%d",&a); scanf("%d",&b); add(&dlie1,done(a,b)); } for(i = 0;i < c;i++){ e = out(&dlie1); if(e == 0) printf("MMM BRAINS\n"); else printf("NO BRAINS\n"); } getch(); }北京大学程序在线评测系统poj里的问题2027,我的解决方案如上,但是提交之后却是编译错误,可我用WIN-TC可以运行我的题目,并且结果也是正确的。我就不知道为什么了,各位帮忙看一下!