## 只需要提交补充的那一部分代码,提交时选择C/C++方式提交

#include <stdio.h>
#include <stdlib.h>
struct necklace
{
int value;
struct necklace* next;
};
struct necklace *create_necklace(int n)
{
int value,i;
for(i=0; i<n; i++)
{
scanf("%d", &value);
p = (struct necklace *)malloc(sizeof(struct necklace));
p->value = value;
p->next = NULL;
else
last->next = p;
last= p;
}
};

{
struct necklace *p;
int sumvalue=0,maxvalue=0;
/*
完善并提交该部分代码
*/
}
void free_necklace(struct necklace *head)  /* 调用时，形式参数h得到链表的首结点 */
{
struct necklace *p,*q;
while(p!=NULL)
{
q=p;
p = p->next;
free(q);
}
}
int main()
{
int m,n;
scanf("%d%d",&m,&n);
printf("Yes");
else
printf("No");
return 0;
}

### 样例输入

100
10
12 9 18 3 14 9 20 3 2 33

No

### 代码如下

``````
#include <stdio.h>
#include <stdlib.h>
struct necklace
{
int value;
struct necklace* next;
};
struct necklace *create_necklace(int n)
{
int value,i;
for(i=0; i<n; i++)
{
scanf("%d", &value);
p = (struct necklace *)malloc(sizeof(struct necklace));
p->value = value;
p->next = NULL;
else
last->next = p;
last= p;
}
};

{
struct necklace *p;
int sumvalue=0,maxvalue=0;
maxvalue=p->value;
p=p->next;
while(p!=NULL)
{
if(p->value>maxvalue)
maxvalue=p->value;
p=p->next;
}
while(p!=NULL)
{
if(p->value!=maxvalue)
sumvalue+=p->value;
p=p->next;
}
if(sumvalue>m)
return 1;
else
return 0;
}
void free_necklace(struct necklace *head)  /* 调用时，形式参数h得到链表的首结点 */
{
struct necklace *p,*q;
while(p!=NULL)
{
q=p;
p = p->next;
free(q);
}
}
int main()
{