fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long long n;
  6. int k = 0;
  7. cin >> n;
  8. while (n > 0) {
  9. k += n%3 + 1;
  10. n /= 3;
  11. }
  12. cout << k - 2;
  13. return 0;
  14. }
Success #stdin #stdout 0s 4312KB
stdin
1447
stdout
16