| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 436 人关注过本帖
标题:关于poj_problem_2027
只看楼主 加入收藏
Jung_zh
Rank: 1
等 级:新手上路
帖 子:10
专家分:3
注 册:2013-4-22
结帖率:100%
收藏
 问题点数:0 回复次数:2 
关于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可以运行我的题目,并且结果也是正确的。我就不知道为什么了,各位帮忙看一下!
搜索更多相关主题的帖子: first next color 
2013-05-07 21:23
Jung_zh
Rank: 1
等 级:新手上路
帖 子:10
专家分:3
注 册:2013-4-22
收藏
得分:0 
Compile Error

Main.c
Main.obj : error LNK2019: unresolved external symbol _getch referenced in function _main
F:\temp\11568981.93225\Main.exe : fatal error LNK1120: 1 unresolved externals
2013-05-07 22:13
Jung_zh
Rank: 1
等 级:新手上路
帖 子:10
专家分:3
注 册:2013-4-22
收藏
得分:0 
这个是错误的提示。我不懂啊。谁会的帮帮忙,谢谢了。
2013-05-07 22:14
快速回复:关于poj_problem_2027
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017704 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved