Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么总是Wrong Answer?

Posted by X_CrDjN at 2006-07-20 10:28:04 on Problem 2509
# include <stdio.h>
# include <malloc.h>
main()
{int n,k,t,s;
typedef struct node {int x;struct node *link;}JD;JD *h,*v,*r;h=(JD *)malloc(sizeof(JD));v=h;h->link=NULL;
while (scanf("%d %d",&n,&k) != EOF)
{	
	t=n/k;s=n%k;
	do
	{n=n+t;
	t=(t+s)/k;s=(t+s)%k;
	}while (((t+s)/k)!=0);
r=(JD *)malloc(sizeof(JD));r->x=n;r->link=NULL;h->link=r;r->link=NULL;h=h->link;
}	v=v->link;while(v->link!=NULL){printf("%d\n",v->x);v=v->link;}printf("%d",v->x);
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator