博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ACM山东工商 Contest - 软件171-2 第1次测验
阅读量:4510 次
发布时间:2019-06-08

本文共 1528 字,大约阅读时间需要 5 分钟。

#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\n");
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\n");
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\n");
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);
}

转载于:https://www.cnblogs.com/jiang-bei/p/9714738.html

你可能感兴趣的文章
java并发多面性
查看>>
TFS 测试用例导入、导出工具
查看>>
java -jstack
查看>>
C#中线程调用带有参数的方法
查看>>
单片机的模块化编程
查看>>
[转]从3个IT公司里学到的57条经验
查看>>
Test指令
查看>>
c++11——可变参数模板
查看>>
from imp import * 重新加载导入的模块reload
查看>>
二叉树三种遍历调试运行版
查看>>
关于PHP、python使用的CRC32函数
查看>>
JS自动关闭授权弹窗,并刷新父页面
查看>>
c#语言几种常见循环代码
查看>>
SQL多表连接查询(详细实例)
查看>>
Http中涉及到的知识点总结
查看>>
adb命令记录
查看>>
swift初学日志
查看>>
Eclipse上GIT插件_客户端配置
查看>>
JavaScript浏览器对象之二Document对象
查看>>
js 乘除算法 浮点 精度解决办法
查看>>