_takumi

num14.2

Oct 26th, 2020
546
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. unsigned long long pow(unsigned long long a, int n) {
  5.     unsigned long long p = 1;
  6.     for (int i = 0; i < n; i++)
  7.         p *= a;
  8.     return p;
  9. }
  10.  
  11. int main() {
  12.     unsigned long long int n = pow(81, 17) + pow(3, 24) - 45;
  13.     multiset<int> ans;
  14.     while (n > 0) {
  15.         ans.insert(n % 9);
  16.         n /= 9;
  17.     }
  18.     cout << ans.count(8);
  19.     return 0;
  20. }
  21.  
  22. /*Значение выражения 81^17 + 3^24 – 45 записали в системе счисления с основанием 9. Сколько цифр 8 содержится в этой записи?*/
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×