提交记录 #466
提交时间:2024-12-10 10:03:47
语言:c
状态:Accepted
编译情况:编译成功
固定测试点#1:
固定测试点#2:
固定测试点#3:
固定测试点#4:
额外测试点#3600:
H25【选做▪中学】求循环节
#include<string.h>
NODE *result, *tmp[1000000];
void change(int n, int m, NODE * head){
memset(tmp,0,sizeof(NODE)); n%=m;
while(tmp[n]==NULL){
NODE *p=malloc(sizeof(NODE));
p->data=n*10/m; p->next=NULL;
tmp[n]=p; head->next=p;
n=n*10%m; head=p;
}
head->next=tmp[n];
result=tmp[n];
}
NODE *find(NODE * head, int * n){
*n=1; for(NODE *p=result->next;p!=result;p=p->next) (*n)+=1;
if(((*n)==1)&&result->data==0){*n=0;return NULL;}
return result;
}