注意while(scanf("%d %d", &n, &k) == 2),如果是while(scanf("%d %d", &n, &k))则会ole
#
include<stdio.h>
int main()
{
int n , k , sum;
while (scanf( " %d %d " , & n , & k) == 2 )
{
sum = n;
while (n >= k)
{
sum += n / k;
n = n / k + n % k;
}
printf ( " %d/n " , sum);
}
return 0 ;
}
int main()
{
int n , k , sum;
while (scanf( " %d %d " , & n , & k) == 2 )
{
sum = n;
while (n >= k)
{
sum += n / k;
n = n / k + n % k;
}
printf ( " %d/n " , sum);
}
return 0 ;
}