| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么总是Wrong Answer?# 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator