SHARE
TWEET

Nie ma co komibnować

a guest May 22nd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Autor - Łukasz Janus
  2. #include <cstdio>
  3.  
  4. int main()
  5. {
  6.     int t;
  7.     scanf("%d", &t);
  8.     int p, n, result;
  9.     for (int i = 0; i < t; i++)
  10.     {
  11.         scanf("%d %d", &p, &n);
  12.         result = 0;
  13.         while (n)
  14.         {
  15.             result += n % p;
  16.             n /= p;
  17.         }
  18.         printf("%d\n", result);
  19.     }
  20.  
  21.     return 0;
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top