| ||||||||||
| 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 | |||||||||
我的没这问题,也wa ,为何,代码在下面In Reply To:不是精度不够,是你没考虑到这种情况。 Posted by:tdzl2003 at 2005-07-27 20:58:12 /*pku 2509 Peter's smokes 051210*/
#include<stdio.h>
int main()
{
long n,nn,k;
long sum,rst;
for(;scanf("%ld%ld",&n,&k)!=EOF;)
{
for(sum=n,rst=0,nn=n;nn;sum+=(rst+nn)/k,rst=nn%k,nn/=k)
;
printf("%ld\n",sum);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator