當前位置:編程學習大全網 - 電腦編程 - C語言題,求程序(C++也行) 1、喝汽水(drink) 問題描述 John特別喜歡喝可樂,經

C語言題,求程序(C++也行) 1、喝汽水(drink) 問題描述 John特別喜歡喝可樂,經

#include <stdio.h>

int main()

{

int t,n, k, total;

scanf("%d",&t);

while (t--)

{

scanf("%d %d", &n, &k);

total = 0;

int count=n;

while (count >= k)

{

total += count/k;

count/=k;

}

printf("%d\n", total+n);

}

return 0;

}

  • 上一篇:學習通信工程的大學生,希望能進中國移動、聯通、電信或華為這樣有名譽的公司,應該掌握哪些技能呢?
  • 下一篇:Python 未來將會被什麽語言取代?
  • copyright 2024編程學習大全網