zoukankan      html  css  js  c++  java
  • ACM山东工商 Contest

    #include <stdio.h>
    #include <stdlib.h>

    typedef struct Node
    {
    int data;
    struct Node *next;
    }LNode,*LinkList;

    void construt(int temp,struct Node *head)
    {
    struct Node *cycle;
    cycle = head;
    while(temp--)
    {
    cycle->next = (struct Node*)malloc(sizeof(struct Node));
    cycle = cycle->next;
    scanf("%d",&cycle->data);
    cycle->next = NULL;
    }
    cycle->next = head;
    }

    void output(struct Node *head)
    {
    struct Node *cycle;
    cycle = head;
    while(cycle->next != head)
    {
    printf("%d ",cycle->next->data);
    cycle = cycle->next;
    }
    }
    int compear(struct Node *head,int temp)
    {
    int signal = 0;
    struct Node *cycle,*http,*Next;
    cycle = head;
    while(cycle->next != head)
    {
    if(cycle->next->data == temp)
    {
    printf("1 ");
    signal = 1;
    return 0;
    }
    cycle = cycle->next;
    }
    cycle = head;
    while(cycle->next != head)
    {
    if(cycle->next->data > temp)
    {
    Next = cycle;
    cycle = cycle->next;
    printf("0 ");
    http = (struct Node*)malloc(sizeof(struct Node));
    http -> data = temp;
    Next -> next = http;
    http->next = cycle;
    signal = 1;
    return 0;
    }
    Next = cycle;
    cycle = cycle->next;
    }
    http = (struct Node*)malloc(sizeof(struct Node));
    http -> data = temp;
    http -> next = head;
    printf("0 ");
    cycle->next = http;
    return 0;
    }
    int main(int argc, char *argv[])
    {
    int numberOne,numberTwo;
    scanf("%d",&numberOne);
    struct Node *headA;
    struct Node *headB;
    struct Node *headC;
    headA = (struct Node*)malloc(sizeof(struct Node));
    headA->next = NULL;
    construt(numberOne,headA);
    scanf("%d",&numberTwo);
    compear(headA,numberTwo);
    output(headA);
    }

  • 相关阅读:
    C# Redis实战(四)
    C# Redis实战(三)
    C# Redis实战(二)
    C# Redis实战(一)
    C#连接内存数据库redis【1、Redis存读取数据】
    C#连接内存数据库redis【1、安装配置】
    c#根据配置文件反射
    内存数据库:Redis与Memcached的区别
    内存数据库:memcached与redis技术的对比试验
    【转】【涨姿势】支付宝怎么做风险控制?
  • 原文地址:https://www.cnblogs.com/jiang-bei/p/9714738.html
Copyright © 2011-2022 走看看